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/06/10 21:25:52 UTC

[couchdb] 01/01: Handle transaction and future timeouts in couch_jobs notifiers

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

vatamane pushed a commit to branch handle-timeouts-in-couch-jobs-notifier
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1e7e91aa80d5c8602659a100023124454e4e0bb8
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed Jun 10 17:22:36 2020 -0400

    Handle transaction and future timeouts in couch_jobs notifiers
    
    In an overload scenario do not let notifiers crash and lose their subscribers,
    instead make them more robust and let them retry on future or transaction
    timeouts.
---
 src/couch_jobs/src/couch_jobs_notifier.erl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/couch_jobs/src/couch_jobs_notifier.erl b/src/couch_jobs/src/couch_jobs_notifier.erl
index 1c554a0..67d63ea 100644
--- a/src/couch_jobs/src/couch_jobs_notifier.erl
+++ b/src/couch_jobs/src/couch_jobs_notifier.erl
@@ -228,6 +228,15 @@ get_active_since(#st{jtx = JTx, type = Type, subs = Subs}, VS) ->
     end, maps:with(maps:keys(Subs), AllUpdated)).
 
 
+try_notify_subscribers(ActiveVS, #st{} = St) ->
+    try
+        notify_subscribers(ActiveVS, St)
+    catch
+        error:{timeout, _} -> try_notify_subscribers(ActiveVS, St);
+        error:{erlfdb_error, 1031} -> try_notify_subscribers(ActiveVS, St)
+    end.
+
+
 notify_subscribers(_, #st{subs = Subs} = St) when map_size(Subs) =:= 0 ->
     St;