diff options
-rw-r--r-- | src/couchdb/couch_rep_db_listener.erl | 10 |
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}. |