Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C7C3F600 for ; Thu, 18 Apr 2013 05:28:37 +0000 (UTC) Received: (qmail 40439 invoked by uid 500); 18 Apr 2013 05:28:37 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 40305 invoked by uid 500); 18 Apr 2013 05:28:35 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 40244 invoked by uid 99); 18 Apr 2013 05:28:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2013 05:28:32 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of snbartell@gmail.com designates 209.85.219.54 as permitted sender) Received: from [209.85.219.54] (HELO mail-oa0-f54.google.com) (209.85.219.54) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2013 05:28:27 +0000 Received: by mail-oa0-f54.google.com with SMTP id l20so2399921oag.13 for ; Wed, 17 Apr 2013 22:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=i680pM4TpYB3MZ36qI+lJ6cjCoz650GYz59AVWQ2m9o=; b=hIlKdmRyv/rhkqZNP8eMagbf209RsCKEG4wYvKPz63fYVau7q3G4lrdocYwpQdk0NK URPHNBFZbsWjx7gssTDvnqEThggqlgrilq8yVvoD7qLLFwEa+F9zyuMZlN3rNVj2UyAd 6wGuit0g63otAmDfWKg9QCU54TRG0Ad1Zv7gHKt1kLM18upbD5h502M11PO6n7UhDB+v b10Ib2lUZY8RWLzHTMjV738u5Y6yN27zUA33ODMEh0ij7V5QOFib++XKoNkBilCGCPas w+KEfEdvoK032MVIINVEkKz33mBAXwRCho2VQ6XTfn8fL4CFj5t1IUK6fJ9mvaHC04Oa +/9w== X-Received: by 10.60.103.79 with SMTP id fu15mr4572708oeb.127.1366262887102; Wed, 17 Apr 2013 22:28:07 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-172-115-146.socal.res.rr.com. [76.172.115.146]) by mx.google.com with ESMTPS id s4sm3258657obx.7.2013.04.17.22.28.04 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 22:28:05 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: EventSource periodically dumps db contents. From: Stephen Bartell In-Reply-To: Date: Wed, 17 Apr 2013 22:28:02 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <8C2B5F28-E7CB-4044-AE19-F9763B0497B7@gmail.com> References: <09A61F63-509E-40C4-A719-3E36BAE33A27@gmail.com> To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1503) X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the summary Robert. That clears it all up :) Ok so now I'm going to risk looking like a tool. Besides the underlying = mechanism, what is the difference between eventsource and continuous? = In other words, what does ES bring to the table that continuous does = not? I was originally excited about event source because for some = reason i had it in my head that multiple event source subscriptions = would use the same connection, thus circumventing the open connection = limits on browsers. Best Stephen On Apr 17, 2013, at 4:31 AM, Robert Newson wrote: > Setting timeout and heartbeat to the same value is going to lead to > exactly what you're seeing. >=20 > The timeout setting is how long, without an event, the connection will > stay open. >=20 > The heartbeat setting is how long to wait, without an event, before > sending a newline character to keep the connection from timing out. >=20 > What you're seeing is that the timeout happens before the heartbeat, > since both are happening approximately simultaneously. >=20 > Just set heartbeat=3D5000 and rely on the timeout default of 1 minute, > or specify timeout to whatever multiple of heartbeat you find useful > (as long as it's more than one). >=20 > Summary: timeout =3D=3D heartbeat is not going to keep the connection = alive. >=20 > B. >=20 >=20 >=20 >=20 >=20 > On 17 April 2013 10:29, Stephen Bartell wrote: >> Ok heres a test script. Have a couch serving localhost:5984 in admin = party mode. >>=20 >> git clone https://github.com/snbartell/couch-es-test.git >> cd couch-es-test >> npm install >> node index.js >>=20 >> My theory of a second source crashing couch was wrong. >>=20 >> I think I know whats going on. My script above acts just like the = browser does. When the `timeou`t is reached and `heartbeat` !=3D=3D = `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`. >>=20 >> 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=3D2&feed=3Dcontinuous&timeou= t=3D5000&heartbeat=3D5000" >>=20 >> 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 =3D new = EventSource('/source1/_changes?feed=3Deventsource&timeout=3D5000&heartbeat= =3D5000') >>=20 >> 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? >>=20 >> Still though, if I call EventSource without `timeout` and = `heartbeat`, then couchdb will use the defaults of 60000 each. Then, = with `timeout` =3D=3D=3D `heartbeat`, the connection should be kept = alive, right? >>=20 >> Thanks guys, >>=20 >> Stephen >>=20 >>=20 >> On Apr 16, 2013, at 11:17 PM, Stephen Bartell = wrote: >>=20 >>>=20 >>> On Apr 16, 2013, at 11:13 PM, Benoit Chesneau = wrote: >>>=20 >>>> On Wed, Apr 17, 2013 at 7:55 AM, Stephen Bartell = wrote: >>>>>=20 >>>>> 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. >>>>>=20 >>>>=20 >>>> Hi Stephen, >>>>=20 >>>> 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 : >>>=20 >>> Yep, Im actually working on it now :) >>>=20 >>>>=20 >>>> 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. >>>=20 >>>> 2. If it's a javascript error >>> nope. its a couch thing. >>>=20 >>>> 3. ? >>>>=20 >>>> - benoit >>>=20 >>=20