summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-11-24 16:06:12 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-11-24 16:06:12 +0000
commit894d8f2cc9c8ebaf6ff025de393b3d95be4bd548 (patch)
tree945586d54294885660c90f2cc4979e6472f6a44f /src
parentbdc029ff820f44b1c39021298edc53c013fa85b2 (diff)
Merged revision 1038660 from trunk:
Replicator DB: fix a rare gen_server death case. Happened when the rep_db_created message is received before the changes loop dies. Also simplified a bit the handling of subprocesses exits. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1038662 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_rep_db_listener.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/couchdb/couch_rep_db_listener.erl b/src/couchdb/couch_rep_db_listener.erl
index c33d2c9a..bd47ac8f 100644
--- a/src/couchdb/couch_rep_db_listener.erl
+++ b/src/couchdb/couch_rep_db_listener.erl
@@ -63,12 +63,15 @@ handle_cast(rep_db_changed, State) ->
changes_feed_loop = Loop,
changes_queue = Queue
} = State,
- exit(Loop, rep_db_changed),
+ unlink(Loop),
+ catch exit(Loop, rep_db_changed),
couch_work_queue:queue(Queue, stop_all_replications),
{ok, NewLoop} = changes_feed_loop(Queue),
{noreply, State#state{changes_feed_loop = NewLoop}};
-handle_cast(rep_db_created, #state{changes_feed_loop = nil} = State) ->
+handle_cast(rep_db_created, #state{changes_feed_loop = Loop} = State) ->
+ unlink(Loop),
+ catch exit(Loop, rep_db_changed),
{ok, NewLoop} = changes_feed_loop(State#state.changes_queue),
{noreply, State#state{changes_feed_loop = NewLoop}};
@@ -86,9 +89,6 @@ handle_info({'EXIT', From, Reason}, #state{db_notifier = From} = State) ->
?LOG_ERROR("Database update notifier died. Reason: ~p", [Reason]),
{stop, {db_update_notifier_died, Reason}, State};
-handle_info({'EXIT', _OldChangesLoop, rep_db_changed}, State) ->
- {noreply, State};
-
handle_info({'EXIT', From, Reason}, #state{changes_processor = From} = State) ->
?LOG_ERROR("Replicator DB changes processor died. Reason: ~p", [Reason]),
{stop, {rep_db_changes_processor_died, Reason}, State}.