diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-01-10 13:23:50 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-01-10 13:23:50 +0000 |
| commit | e47a2844081265fd83451548ad49e252e9e677ed (patch) | |
| tree | 651888dd12f5fa87711ed90193976427f3ef60e4 | |
| parent | a0563673e60e67e139a7f69e5ff9ded5768dd5dc (diff) | |
| download | rabbitmq-server-git-e47a2844081265fd83451548ad49e252e9e677ed.tar.gz | |
Automatically update process_name on become.
| -rw-r--r-- | src/gen_server2.erl | 17 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_slave.erl | 1 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gen_server2.erl b/src/gen_server2.erl index d22a3f033e..b0212e47f8 100644 --- a/src/gen_server2.erl +++ b/src/gen_server2.erl @@ -909,9 +909,17 @@ common_noreply(_Name, _NState, [] = _Debug) -> common_noreply(Name, NState, Debug) -> sys:handle_debug(Debug, fun print_event/3, Name, {noreply, NState}). -common_become(_Name, _Mod, _NState, [] = _Debug) -> + +common_become(Name, OldMod, NewMod, NState, Debug) -> + case get(process_name) of + {OldMod, ProcName} -> put(process_name, {NewMod, ProcName}); + _ -> ok + end, + common_become0(Name, NewMod, NState, Debug). + +common_become0(_Name, _Mod, _NState, [] = _Debug) -> []; -common_become(Name, Mod, NState, Debug) -> +common_become0(Name, Mod, NState, Debug) -> sys:handle_debug(Debug, fun print_event/3, Name, {become, Mod, NState}). handle_msg({'$gen_call', From, Msg}, GS2State = #gs2_state { mod = Mod, @@ -943,6 +951,7 @@ handle_msg(Msg, GS2State = #gs2_state { mod = Mod, state = State }) -> handle_common_reply(Reply, Msg, GS2State). handle_common_reply(Reply, Msg, GS2State = #gs2_state { name = Name, + mod = Mod0, debug = Debug}) -> case Reply of {noreply, NState} -> @@ -956,14 +965,14 @@ handle_common_reply(Reply, Msg, GS2State = #gs2_state { name = Name, time = Time1, debug = Debug1}); {become, Mod, NState} -> - Debug1 = common_become(Name, Mod, NState, Debug), + Debug1 = common_become(Name, Mod0, Mod, NState, Debug), loop(find_prioritisers( GS2State #gs2_state { mod = Mod, state = NState, time = infinity, debug = Debug1 })); {become, Mod, NState, Time1} -> - Debug1 = common_become(Name, Mod, NState, Debug), + Debug1 = common_become(Name, Mod0, Mod, NState, Debug), loop(find_prioritisers( GS2State #gs2_state { mod = Mod, state = NState, diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index 3b91b39d00..3027f62b2e 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -617,7 +617,6 @@ promote_me(From, #state { q = Q = #amqqueue { name = QName }, KS1 = lists:foldl(fun (ChPid0, KS0) -> pmon:demonitor(ChPid0, KS0) end, KS, AwaitGmDown), - rabbit_misc:store_proc_name(rabbit_amqqueue_process, QName), rabbit_amqqueue_process:init_with_backing_queue_state( Q1, rabbit_mirror_queue_master, MasterState, RateTRef, Deliveries, KS1, MTC). |
