davisp commented on a change in pull request #623: Ensure replicator
_active_tasks entry reports recent pending changes
URL: https://github.com/apache/couchdb/pull/623#discussion_r124678957
##########
File path: src/couch_replicator/src/couch_replicator_scheduler_job.erl
##########
@@ -652,16 +652,34 @@ changes_manager_loop_open(Parent, ChangesQueue,
BatchSize, Ts) ->
case couch_work_queue:dequeue(ChangesQueue, BatchSize) of
closed ->
From ! {closed, self()};
- {ok, Changes} ->
- #doc_info{high_seq = Seq} = lists:last(Changes),
- ReportSeq = {Ts, Seq},
- ok = gen_server:cast(Parent, {report_seq, ReportSeq}),
- From ! {changes, self(), Changes, ReportSeq}
+ {ok, ChangesOrLastSeqs} ->
+ ReportSeq = case lists:last(ChangesOrLastSeqs) of
+ {last_seq, Seq} ->
+ {Ts, Seq};
+ #doc_info{high_seq = Seq} ->
+ {Ts, Seq}
+ end,
+ Changes = lists:filter(
+ fun(#doc_info{}) ->
+ true;
+ ({last_seq, _Seq}) ->
+ false
+ end, ChangesOrLastSeqs),
+ maybe_report_in_progress(Parent, Changes, From, Ts),
Review comment:
There's no maybe here any more. You need to just hoist
gen_server:cast(Parent, {report_Seq, ReportSeq}) out now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services