couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject fabric commit: updated refs/heads/3149-delete-db-with-change-feed to b534034
Date Thu, 15 Sep 2016 15:22:21 GMT
Repository: couchdb-fabric
Updated Branches:
  refs/heads/3149-delete-db-with-change-feed [created] b53403472


Avoid throwing exception when deleting db in db updater listener

Handle db deletion explicitly. Previously handle_db_event callback returned
`{stop, St}`. That return value was not handled by the caller, instead it
resulted in it being used as reason in an erlang:error, which then ended up in
the log.

Jira: COUCHDB-3149


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/b5340347
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/b5340347
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/b5340347

Branch: refs/heads/3149-delete-db-with-change-feed
Commit: b5340347294ac8047619df23b1586774d22e5b71
Parents: f84750e
Author: Nick Vatamaniuc <vatamane@apache.org>
Authored: Thu Sep 15 11:16:19 2016 -0400
Committer: Nick Vatamaniuc <vatamane@apache.org>
Committed: Thu Sep 15 11:16:19 2016 -0400

----------------------------------------------------------------------
 src/fabric_db_update_listener.erl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/b5340347/src/fabric_db_update_listener.erl
----------------------------------------------------------------------
diff --git a/src/fabric_db_update_listener.erl b/src/fabric_db_update_listener.erl
index 074ec53..1fd9254 100644
--- a/src/fabric_db_update_listener.erl
+++ b/src/fabric_db_update_listener.erl
@@ -84,7 +84,8 @@ handle_db_event(_DbName, updated, #cb_state{notify = true} = St) ->
     erlang:send(St#cb_state.client_pid, {St#cb_state.client_ref, db_updated}),
     {ok, St};
 handle_db_event(_DbName, deleted, St) ->
-    {stop, St};
+    erlang:send(St#cb_state.client_pid, {St#cb_state.client_ref, db_deleted}),
+    stop;
 handle_db_event(_DbName, _Event, St) ->
     {ok, St}.
 
@@ -155,6 +156,8 @@ handle_message(db_updated, _Worker, #acc{state=waiting}=Acc) ->
     {ok, Acc#acc{state=unset}};
 handle_message(db_updated, _Worker, Acc) ->
     {ok, Acc#acc{state=updated}};
+handle_message(db_deleted, _Worker, Acc) ->
+    {stop, ok};
 handle_message(get_state, _Worker, #acc{state=unset}=Acc) ->
     {ok, Acc#acc{state=waiting}};
 handle_message(get_state, _Worker, Acc) ->


Mime
View raw message