couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Bartell <>
Subject Re: EventSource periodically dumps db contents.
Date Wed, 17 Apr 2013 09:29:12 GMT
Ok heres a test script.  Have a couch serving localhost:5984 in admin party mode.

git clone
cd couch-es-test
npm install
node index.js

My theory of a second source crashing couch was wrong.

I think I know whats going on.  My script above acts just like the browser does.  When the
`timeou`t is reached and `heartbeat` !== `timeout`, the EventSource module (whether its the
browser or the node package) will restart the feed.  This is why every `timeout` ms the feed
__appears__ to by dumping all the docs since `since`.

curling works fine. Try this after running the above script and leaving the test db in place.
 I expect this behavior.
     curl "http://localhost:5984/source1/_changes?since=2&feed=continuous&timeout=5000&heartbeat=5000"

So then it comes to using this in Chrome console.  If you go to the couch you ran the script
against,  open the console, and paste the following:
var source1 = new EventSource('/source1/_changes?feed=eventsource&timeout=5000&heartbeat=5000')

Watch the Network panel.  It looks like EventSource does not pass the query params.  I'm probably
being an idiot and not calling it correctly.  I googled around and couldn't find the api.
 Does someone have a link?

Still though, if I call EventSource without `timeout` and `heartbeat`, then couchdb will use
the defaults of 60000 each.  Then, with `timeout` === `heartbeat`, the connection should be
kept alive, right?

Thanks guys,


On Apr 16, 2013, at 11:17 PM, Stephen Bartell <> wrote:

> On Apr 16, 2013, at 11:13 PM, Benoit Chesneau <> wrote:
>> On Wed, Apr 17, 2013 at 7:55 AM, Stephen Bartell <> wrote:
>>> But for what I was doing, no, I wasn't specifying since.  I would expect the
fundamentals to be the same as well.  What I was see is that even without `since` given, no
changes would come through until that second source was added.  Once the second source is
added, then all sources periodically dump.
>> Hi Stephen,
>> Can you provide a clear way to reproduce what you're doing and the
>> result you're expecting. It's not clear for me right now if you :
> Yep, Im actually working on it now :)
>> 1. the reauest results when giving the since parameter without any
>> changes  , did you try using curl?
> no.  I only did it from the browser console.
>> 2. If it's a javascript error
> nope. its a couch thing.
>> 3. ?
>> - benoit

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message