You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/05/29 21:38:13 UTC

[GitHub] [couchdb] nickva commented on a change in pull request #2918: Guard couch_jobs:accept_loop timing out

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



##########
File path: src/couch_jobs/src/couch_jobs.erl
##########
@@ -297,9 +297,17 @@ accept_loop(Type, NoSched, MaxSchedTime, Timeout) ->
     TxFun =  fun(JTx) ->
         couch_jobs_fdb:accept(JTx, Type, MaxSchedTime, NoSched)
     end,
-    case couch_jobs_fdb:tx(couch_jobs_fdb:get_jtx(), TxFun) of
+    AcceptResult = try
+        couch_jobs_fdb:tx(couch_jobs_fdb:get_jtx(), TxFun)
+    catch
+        error:{erlfdb_error, Err} when Err =:= 1020 orelse Err =:= 1031 ->
+            retry
+    end,
+    case AcceptResult of
         {ok, Job, Data} ->
             {ok, Job, Data};
+        retry ->
+            accept_loop(Type, NoSched, MaxSchedTime, Timeout);

Review comment:
       We are ok retrying it forever in a loop in case of transaction timeouts. We will exit the loop with `{error, not_found}` in case the user specifies a `Timeout` option but we don't want the global (default) transaction settings to affect indexers waiting to accept jobs




----------------------------------------------------------------
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:
users@infra.apache.org