GitHub user unclespode opened a pull request:
https://github.com/apache/couchdb/pull/60
Update jquery.couch.js
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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/unclespode/couchdb patch-1
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb/pull/60.patch
----
commit c41856aab25ce4ba621b69460d026b73e75f8d6b
Author: unclespode <[email protected]>
Date: 2013-05-17T11:16:03Z
Update jquery.couch.js
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.
----