-
Notifications
You must be signed in to change notification settings - Fork 2k
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
s3, s3-multipart, tus: queue requests for soken token for remote files #3797
Conversation
I'm getting this concerning error message in the console:
It does still timeout when I try to upload 300 files with a limit of |
I tested this on Tus with Google Drive with a Perhaps we should discourage a |
I just tried and it's failing for me. In fact I think it's failing even with the default limit of
Same for me, I agree it's an improvement. Maybe we need to rename this PR as it looks like it does not fix timeout but rather the error we have on
Keep in mind that the RateLimiterQueue will set itself to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice job!
I think if it's true that "RateLimiterQueue will set itself to 1 when getting a 429 response", then we need to find out why it fails with limit 1, because an uploader that becomes unstable only in some hard-to-test scenarios (429), is going to cause problems for us in the future and will be really tricky to fix later.
this.uppy.setFileState(file.id, { serverToken: res.token }) | ||
await this.connectToServerSocket(this.uppy.getFile(file.id)) | ||
if (file.serverToken) { | ||
return this.connectToServerSocket(file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the purpose of calling this here? I thought this should only happen after await this.#queueRequestSocketToken(file)
has returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we retry then this is called again but we don't need a new server token, we already have it. In some other instances it's also possible to already have it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, a comment could be nice
const serverToken = await this.#queueRequestSocketToken(file) | ||
|
||
this.uppy.setFileState(file.id, { serverToken }) | ||
return this.connectToServerSocket(this.uppy.getFile(file.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't we just do return this.connectToServerSocket(file)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the await
make the file
instance outdated? If the file was removed by the user while this code was waiting for the RateLimitedQueue to dispatch maybe? If so, it wouldn't be equivalent to return this.connectToServerSocket(file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's indeed safer to do it this way. It's also cheap so it doesn't matter much
Note that is doesn't inherently fail on |
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/aws-s3 | 2.2.1 | @uppy/tus | 2.4.1 | | @uppy/aws-s3-multipart | 2.4.1 | @uppy/url | 2.2.0 | | @uppy/companion-client | 2.2.1 | @uppy/xhr-upload | 2.1.2 | | @uppy/core | 2.3.1 | @uppy/robodog | 2.8.0 | | @uppy/react | 2.2.2 | uppy | 2.12.0 | | @uppy/remote-sources | 0.1.0 | | | - @uppy/remote-sources: Add @uppy/remote-sources preset/plugin (Artur Paikin / #3676) - @uppy/react: Reset uppy instance when React component is unmounted (Tomasz Pęksa / #3814) - @uppy/aws-s3-multipart,@uppy/aws-s3,@uppy/tus: queue socket token requests for remote files (Merlijn Vos / #3797) - @uppy/xhr-upload: replace `ev.target.status` with `xhr.status` (Wes Sankey / #3782) - @uppy/core: fix `TypeError` when file was deleted (Antoine du Hamel / #3811) - @uppy/robodog: fix linter warnings (Antoine du Hamel / #3808) - meta: fix GHA workflow for prereleases (Antoine du Hamel) - @uppy/aws-s3-multipart: allow `companionHeaders` to be modified with `setOptions` (Paulo Lemos Neto / #3770) - @uppy/url: enable passing optional meta data to `addFile` (Brad Edelman / #3788) - @uppy/url: fix `getFileNameFromUrl` (Brad Edelman / #3804) - @uppy/tus: make onShouldRetry type optional (Merlijn Vos / #3800) - doc: fix React examples (Antoine du Hamel / #3799) - meta: add GHA workflow for prereleases (Antoine du Hamel)
Fixes #3640
Tested with 300+ files. But things can go wrong with a
limit
of0
or1
on a slow connection for instance. But it's still an improvement.Before
After