summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/couch_replicator/src/couch_replicator_jobs.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/couch_replicator/src/couch_replicator_jobs.erl b/src/couch_replicator/src/couch_replicator_jobs.erl
index a602b0c62..51f441caf 100644
--- a/src/couch_replicator/src/couch_replicator_jobs.erl
+++ b/src/couch_replicator/src/couch_replicator_jobs.erl
@@ -170,12 +170,14 @@ wait_running(JobId) ->
wait_running(JobId, SubId) ->
- case couch_jobs:wait(SubId, running, infinity) of
+ case couch_jobs:wait(SubId, infinity) of
{?REP_JOBS, _, running, #{?STATE := ?ST_PENDING}} ->
wait_running(JobId, SubId);
{?REP_JOBS, _, running, JobData} ->
ok = couch_jobs:unsubscribe(SubId),
{ok, JobData};
+ {?REP_JOBS, _, pending, _} ->
+ wait_running(JobId, SubId);
{?REP_JOBS, _, finished, JobData} ->
ok = couch_jobs:unsubscribe(SubId),
{ok, JobData}