nickva commented on a change in pull request #3364:
URL: https://github.com/apache/couchdb/pull/3364#discussion_r581433522



##########
File path: src/couch_replicator/src/couch_replicator_scheduler.erl
##########
@@ -734,6 +775,24 @@ reset_job_process(#job{} = Job) ->
 
 -spec reschedule(#state{}) -> ok.
 reschedule(State) ->
+    % Charge all running jobs for the current interval
+    RunningJobs = running_jobs(),
+    Now = os:timestamp(),
+    lists:foreach(fun(Job) ->
+        couch_replicator_share:charge(Job, State#state.interval, Now)
+    end, RunningJobs),
+
+    % Update usage table
+    couch_replicator_share:update_usage(),
+
+    % Decay all the process priorities
+    couch_replicator_share:decay_priorities(),
+
+    % Adjust running process priorities
+    lists:foreach(fun(Job) ->
+        couch_replicator_share:update_priority(Job)
+    end, RunningJobs),

Review comment:
       Good idea. I was slightly worried about passing in the whole list of 
running jobs into the call




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to