couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [08/50] couch-replicator commit: updated refs/heads/63012-scheduler to 27a5eae
Date Tue, 14 Mar 2017 19:26:03 GMT
When adding job, first call maybe_delete existent job then call add

Previously job was added, then removed. However surprisingly sometimes
it still worked because job was also started (if less then max_job were
running), and during start job record is inserted in the ets table.
However, as soon as max_jobs limit was reached jobs were not added to
the job ets table anymore.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/fabc14ed
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/fabc14ed
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/fabc14ed

Branch: refs/heads/63012-scheduler
Commit: fabc14ed397df451bc01204fda87e5ef150a4e09
Parents: 7bdaba5
Author: Nick Vatamaniuc <vatamane@apache.org>
Authored: Mon Oct 24 17:48:55 2016 -0400
Committer: Nick Vatamaniuc <vatamane@apache.org>
Committed: Mon Oct 24 17:48:55 2016 -0400

----------------------------------------------------------------------
 src/couch_replicator_scheduler.erl | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/fabc14ed/src/couch_replicator_scheduler.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_scheduler.erl b/src/couch_replicator_scheduler.erl
index b43b36c..dadd8b0 100644
--- a/src/couch_replicator_scheduler.erl
+++ b/src/couch_replicator_scheduler.erl
@@ -175,18 +175,13 @@ init(_) ->
 
 
 handle_call({add_job, Job}, _From, State) ->
-    case add_job_int(Job) of
-        true ->
-            ok = maybe_remove_job_int(Job#job.id, State),
-            ok = maybe_start_newly_added_job(Job, State),
-            couch_stats:increment_counter([couch_replicator, jobs, adds]),
-            TotalJobs = ets:info(?MODULE, size),
-            couch_stats:update_gauge([couch_replicator, jobs, total], TotalJobs),
-            {reply, ok, State};
-        false ->
-            couch_stats:increment_counter([couch_replicator, jobs, duplicate_adds]),
-            {reply, {error, already_added}, State}
-    end;
+    ok = maybe_remove_job_int(Job#job.id, State),
+    true = add_job_int(Job),
+    ok = maybe_start_newly_added_job(Job, State),
+    couch_stats:increment_counter([couch_replicator, jobs, adds]),
+    TotalJobs = ets:info(?MODULE, size),
+    couch_stats:update_gauge([couch_replicator, jobs, total], TotalJobs),
+    {reply, ok, State};
 
 handle_call({remove_job, Id}, _From, State) ->
     ok = maybe_remove_job_int(Id, State),


Mime
View raw message