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:31:40 UTC
[couchdb] branch prototype/fdb-layer updated: 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 prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/prototype/fdb-layer by this push:
new b17bc49 Handle transaction and future timeouts in couch_jobs notifiers
b17bc49 is described below
commit b17bc49aac9e20696ca530bb09e21cefa4e4d6d1
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 | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/couch_jobs/src/couch_jobs_notifier.erl b/src/couch_jobs/src/couch_jobs_notifier.erl
index 1c554a0..ff4492b 100644
--- a/src/couch_jobs/src/couch_jobs_notifier.erl
+++ b/src/couch_jobs/src/couch_jobs_notifier.erl
@@ -115,7 +115,7 @@ handle_cast(Msg, St) ->
handle_info({type_updated, VS}, St) ->
VSMax = flush_type_updated_messages(VS),
- {noreply, notify_subscribers(VSMax, St)};
+ {noreply, try_notify_subscribers(VSMax, St)};
handle_info({Ref, ready}, St) when is_reference(Ref) ->
% Don't crash out couch_jobs_server and the whole application would need to
@@ -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;