-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add upload timeout #1377
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
Merged
Merged
Add upload timeout #1377
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You must write unit tests for it, because you've written non-working code second time in a row.
This is not a comparison, but an assignment (the condition is always true in this case).
Total is not a percentage, but amount of data to be transferred, so a comparison with a 100 byte file size doesn't make any sense.
If you're only clearing the timer without resetting, it doesn't add much value beyond response timeout. You could just add upload time to response timeout.
Uh oh!
There was an error while loading. Please reload this page.
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.
yep you right, sorry I was in rush ;), honestly I guess we could add some linter in the project to avoid those mistakes and add it before the build. What do you think?
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 change it but is actually not clear to me the part :
If you're only clearing the timer without resetting, it doesn't add much value beyond response timeout. You could just add upload time to response timeout.
Do you have suggestions for the test?
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 you set timer once, and clear it once, then it's a one fixed length of time from start to finish. It doesn't change the timeout if there's one progress event or 100 progress events in the meantime.
The response timeout timer has the same inflexible behavior - it's set once, and cleared once. The only difference is that it's cleared in readystate rather than progress event, but that's not a major difference most of the time. So effectively your approach doesn't bring anything new.
The adaptive approach would clear timer and set a new one after every single progress event. (that's why I've suggested using a bound method, btw). That would make it adaptive to rate of events.
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.
For the "lint", we use unit tests as the lint. See existing tests. Write an endpoint for our built-in server, and then write code for success and failure case you expect.
Uh oh!
There was an error while loading. Please reload this page.
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.
the lint would be different, ti will promote a common style across all the files http://jshint.com/docs/ . Tests are great but they are not style related they only guarantee that the functionality respect the wanted behaviour. If you see in your codebase there are different case where you use somewhere single/double quote ==/=== and other similars. Have a linter will guarantee a common style across all the contributors. Another usefull file for the indentation could be have an .editorconfig file where is described where any kind of file is formatted
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.
@kornelski your idea is to add an adaptive timeout similar the TCP one? http://www.pcvr.nl/tcpip/tcp_time.htm#21_0 if yes we should understand which strategy apply