diff options
-rw-r--r-- | src/couch_replicator/src/couch_replicator_clustering.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/couch_replicator/src/couch_replicator_clustering.erl b/src/couch_replicator/src/couch_replicator_clustering.erl index 3ea693465..18de1e825 100644 --- a/src/couch_replicator/src/couch_replicator_clustering.erl +++ b/src/couch_replicator/src/couch_replicator_clustering.erl @@ -254,12 +254,26 @@ setup() -> couch_stats, couch_replicator_notifier ]), + stop_clustering_process(), {ok, Pid} = start_link(), Pid. teardown(Pid) -> + stop_clustering_process(Pid). + + +stop_clustering_process() -> + stop_clustering_process(whereis(?MODULE)). + + +stop_clustering_process(undefined) -> + ok; + +stop_clustering_process(Pid) when is_pid(Pid) -> + Ref = erlang:monitor(process, Pid), unlink(Pid), - exit(Pid, kill). + exit(Pid, kill), + receive {'DOWN', Ref, _, _, _} -> ok end. -endif. |