Repository: couchdb-fabric Updated Branches: refs/heads/master 3c204d009 -> b6659c834
Execute a callback at end of each traversal We add this notification before entering a (potentially long) wait for new DB updates so that the client can choose to finalize any processing it might have been doing on earlier updates. The specific use case in chttpd is to flush the client's internal buffer in a timely manner. COUCHDB-2724 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/cede5aa3 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/cede5aa3 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/cede5aa3 Branch: refs/heads/master Commit: cede5aa3a265f027b89b93f029b32543f044a86a Parents: 405922c Author: Adam Kocoloski <[email protected]> Authored: Wed Jun 24 14:05:20 2015 -0400 Committer: Adam Kocoloski <[email protected]> Committed: Wed Jun 24 14:05:20 2015 -0400 ---------------------------------------------------------------------- src/fabric_view_changes.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/cede5aa3/src/fabric_view_changes.erl ---------------------------------------------------------------------- diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl index 7e6666c..7bb4217 100644 --- a/src/fabric_view_changes.erl +++ b/src/fabric_view_changes.erl @@ -84,15 +84,16 @@ keep_sending_changes(DbName, Args, Callback, Seqs, AccIn, Timeout, UpListen, T0) limit = Limit2, counters = NewSeqs, offset = Offset, - user_acc = AccOut + user_acc = AccOut0 } = Collector, LastSeq = pack_seqs(NewSeqs), MaintenanceMode = config:get("couchdb", "maintenance_mode"), NewEpoch = get_changes_epoch() > erlang:get(changes_epoch), if Limit > Limit2, Feed == "longpoll"; MaintenanceMode == "true"; MaintenanceMode == "nolb"; NewEpoch -> - Callback({stop, LastSeq, pending_count(Offset)}, AccOut); + Callback({stop, LastSeq, pending_count(Offset)}, AccOut0); true -> + {ok, AccOut} = Callback(waiting_for_updates, AccOut0), WaitForUpdate = wait_db_updated(UpListen), AccumulatedTime = timer:now_diff(os:timestamp(), T0) div 1000, Max = case config:get("fabric", "changes_duration") of
