janmonschke / backbone-couchdb

A couchdb connector for backbone with support for real time changes.

Home Page:http://janmonschke.com/projects/backbone-couchdb.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

global_changes and fetch problem

ahamid opened this issue · comments

I have run into a really strange problem since upgrading to 1.0 (rewrite from coffeescript).

When I enable global_changes, it appears collection fetch AJAX calls never return (neither success nor error handler is ever invoked). In cucumber tests I observe that the first couple of fetches take a few seconds, but then inevitably the fetches stop returning at all. I traced it down through jQuery, the AJAX call looks correct but after it is sent nothing is ever heard again, and no request is emitted by the browser. Anecdotally I noticed that if I put alerts in the error handler, and reload the page after some actiivty, I will get a ton of error callbacks all at once. It's almost as if the AJAX requests are queued up behind a long poll or something.

If I set global_changes to false, then everything is snappy and callbacks are invoked immediately.

No, I haven't been able to isolate a small reproducible test case :(

Seen on Chrome 14.0 and Firefox 6 on Linux, with CouchDb 1.0.2 and 1.1. jQuery 1.6.4, Backbone 0.5.3, Underscore 1.1.7.

or could it be since i have nested collections, and it looks like a lisener is set on each collection, that i somehow have maxed out browser threads or couch connections? when i access couchdb urls directly it will hang as well...

I just recently returned from my vacation and could not work on this. What was your solution?

It looks like the problem is due to per-collection change feed connections. If the client is a browser, and there are a significant number of collections, this can easily max out the browser open connection limit. Everything will just hang from then on.

I am submitting a pull request which implements support for a single global feed.

Can I close this issue? Since you've found the problem yourself and provided a pull request.

yup, closing