Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API requests that involve uploading files should never be retried #1211

Open
Alex1304 opened this issue May 16, 2024 · 0 comments
Open

API requests that involve uploading files should never be retried #1211

Alex1304 opened this issue May 16, 2024 · 0 comments
Labels
area/rest Related to the rest module: request-stream, routes, rest-api bug A general bug

Comments

@Alex1304
Copy link
Contributor

To Reproduce:

  1. Send a request that uploads a file, like sending a message with an attachment
  2. Have the request fail with a retryable code (in my case I came across a 504 Gateway Timeout)

Expected Behavior:
I expect files to be properly uploaded after retry

Actual Behavior:
It will result in zero-byte files being uploaded. This is because the InputStream provided by the user has already been consumed and closed during the first request attempt.

Version:
Discord4J 3.2.6

In this scenario I think the best option is never to retry requests that accept an InputStream. Another option would be to allow passing a Supplier<InputStream> or something similar, but I feel like it would complicate things both for the user and the d4j API.

@Azn9 Azn9 added bug A general bug area/rest Related to the rest module: request-stream, routes, rest-api labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest Related to the rest module: request-stream, routes, rest-api bug A general bug
Projects
Status: No status
Development

No branches or pull requests

2 participants