You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2020/05/29 21:02:22 UTC

[couchdb] branch guard-job-accept-against-timeouts created (now fda2f45)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch guard-job-accept-against-timeouts
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at fda2f45  Guard couch_jobs:accept_loop timing out

This branch includes the following new commits:

     new fda2f45  Guard couch_jobs:accept_loop timing out

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Guard couch_jobs:accept_loop timing out

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch guard-job-accept-against-timeouts
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit fda2f45c74d963cb38738e98c1add6725c60e1ce
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Fri May 29 16:59:35 2020 -0400

    Guard couch_jobs:accept_loop timing out
    
    And also against too many conflicts during overload
---
 src/couch_jobs/src/couch_jobs.erl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/couch_jobs/src/couch_jobs.erl b/src/couch_jobs/src/couch_jobs.erl
index d9ea0fb..adc1b46 100644
--- a/src/couch_jobs/src/couch_jobs.erl
+++ b/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);
         {not_found, PendingWatch} ->
             case wait_pending(PendingWatch, MaxSchedTime, Timeout) of
                 {error, not_found} ->