-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update jquery.couch.js #60
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
Conversation
In the original code, if there was an error doing the long poll, it would wait 100ms and then try again. If it errors again, it doubles to 200ms. If it errors again, it doubles again etc. with no cap. This means after 10 errors in a row, you will be in a position of waiting a minute and a half before it attempts to reconnect. After that, 3 minutes and then it frankly spirals out of control! That means if you lose internet connectivity (entirely possible if your wireless/3g is flakey) - you will very quickly, essentially lose your polling abilities. My suggestion is to put a cap on this timeout - I've simply added in a conditional so that it will never go above 5 seconds. In my own use case, I'm actually going to keep it at 100ms and not multiply, so it might be worth having this as an option instead of hard coded.
|
I think 5s is too low. We can be much smarter about this whole thing, IMO. What do you think of
Finally, I haven't looked at this code in a while, but we should be sure that the whole thing is cancellable by the application in case the backoff gets large. |
|
Agreed. Rather selfishly, for my own uses I just want it to keep trying rather than back off at all. So this is more of a "are you aware of this issue" rather than an actual proposed fix. I'm not sure who is looking after this plugin - but I'm happy to code these additions if it would be appreciated, otherwise the current maintainer might want to look at the issue. |
|
The whole community maintains it, so feel free to submit another changeset! |
|
@unclespode Cool. Thanks for the pull request. I'd love to see the fuller solution (distinguish timeouts from fast, total connection failure), but it's not critical. If you get the time to improve this please put it here. As is, though, I'm ambivalent about what is the better default. |
|
I've been working on the code as I develop my project at the moment. I've actually written EventSource (SSE) support into the changes function, so that it prefers this over longpolling, with a fallback to long polling where it isn't available, with no discernible difference as far as the coder is concerned. I won't submit the patch until it's finalised. |
|
jquery.couch.js has been moved to https://github.com/apache/couchdb-jquery-couch . If you are still keen on addressing this issue, and the issue still exists, please file a new PR on that repository. |
This closes apache#60 Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
Add latest version getopt that automatically wraps usage output lines
Update lager dep to 2.0.0rc2
In the original code, if there was an error doing the long poll, it would wait 100ms and then try again. If it errors again, it doubles to 200ms. If it errors again, it doubles again etc. with no cap.
This means after 10 errors in a row, you will be in a position of waiting a minute and a half before it attempts to reconnect. After that, 3 minutes and then it frankly spirals out of control!
That means if you lose internet connectivity (entirely possible if your wireless/3g is flakey) - you will very quickly, essentially lose your polling abilities.
My suggestion is to put a cap on this timeout - I've simply added in a conditional so that it will never go above 5 seconds. In my own use case, I'm actually going to keep it at 100ms and not multiply, so it might be worth having this as an option instead of hard coded.