You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/03/09 21:34:41 UTC
[jira] [Commented] (COUCHDB-2961) Let heartbeat work together with
timeout for changes feed
[ https://issues.apache.org/jira/browse/COUCHDB-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15187881#comment-15187881 ]
ASF GitHub Bot commented on COUCHDB-2961:
-----------------------------------------
GitHub user kxepal opened a pull request:
https://github.com/apache/couchdb-fabric/pull/42
Emit heartbeats until feed timeout
COUCHDB-2961
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kxepal/couchdb-fabric 2961-heartbeat-timeout
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-fabric/pull/42.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #42
----
commit 94d130fe36392dbde1fc0e817b75930650c97040
Author: Alexander Shorin <kx...@apache.org>
Date: 2016-03-09T12:48:38Z
Emit heartbeats until feed timeout
COUCHDB-2961
----
> Let heartbeat work together with timeout for changes feed
> ---------------------------------------------------------
>
> Key: COUCHDB-2961
> URL: https://issues.apache.org/jira/browse/COUCHDB-2961
> Project: CouchDB
> Issue Type: Improvement
> Components: HTTP Interface
> Reporter: Alexander Shorin
>
> What do we have now.
> Changes feeds accepts two query parameters: heartbeat and timeout. The heartbeat defines interval of sending heartbeat events (the {{\n}} for continuous and longpoll feeds, special event for eventsource one). The timeout defines the max time to wait for the changes and if nothing happened, CouchDB terminates the feed.
> When you specify heartbeat with timeout together, say {{http://localhost:5984/db/_changes?heartbeat=1000&timeout=5000&feed=continuous}} I guess everyone would expect that we want to receive heartbeats every 1 second and terminate the feed after 5 seconds of inactivity. However, timeout parameter will get ignored and we'll receive heartbeat every second forever.
> How it should work:
> Assume we want to listen continuous changes feed, receive heartbeats every 3 seconds and terminate the feed after 10 seconds of inactivity. Then the request will be sort of:
> {code}
> http://localhost:5984/db/_changes?feed=continuous&timeout=10000&heartbeat=3000
> {code}
> And our expected communication:
> {code}
> - - C - - - H - - - H - C - - - H - - - H - - - H - T
> 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
> 0 1 2
> Legend:
> C - change event
> H - heartbeat
> T - termination
> {code}
> So what we need is to not reset timeout timer by sending heartbeats, but do that by sending real document changes.
> Actually, current implementation swallow timeout parameter, replacing it with heartbeat value and replaces callback that stops the feed with the one that generates heartbeats. The fix should be trivial.
> To preserve backward compatibility we may use default timeout as infinity (the code already supports that) if only heartbeat was explicitly specified.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)