Rearrange order of args to gm:start_link/4 since it seems to make invocations more compact. Curiously I did not need to rearrange the spec as it was already that way round :-)
This commit is contained in:
parent
abed65a0a3
commit
aa1817344b
|
@ -509,8 +509,8 @@ table_definitions() ->
|
|||
{Name, Attributes} = ?TABLE,
|
||||
[{Name, [?TABLE_MATCH | Attributes]}].
|
||||
|
||||
start_link(GroupName, Module, TxnFun, Args) ->
|
||||
gen_server2:start_link(?MODULE, [GroupName, Module, TxnFun, Args], []).
|
||||
start_link(GroupName, Module, Args, TxnFun) ->
|
||||
gen_server2:start_link(?MODULE, [GroupName, Module, Args, TxnFun], []).
|
||||
|
||||
leave(Server) ->
|
||||
gen_server2:cast(Server, leave).
|
||||
|
@ -531,7 +531,7 @@ forget_group(GroupName) ->
|
|||
end),
|
||||
ok.
|
||||
|
||||
init([GroupName, Module, TxnFun, Args]) ->
|
||||
init([GroupName, Module, Args, TxnFun]) ->
|
||||
{MegaSecs, Secs, MicroSecs} = now(),
|
||||
random:seed(MegaSecs, Secs, MicroSecs),
|
||||
Self = make_member(GroupName),
|
||||
|
|
|
@ -106,9 +106,8 @@ spawn_member() ->
|
|||
%% start up delay of no more than 10 seconds
|
||||
timer:sleep(random:uniform(10000)),
|
||||
{ok, Pid} = gm:start_link(
|
||||
?MODULE, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
[]),
|
||||
?MODULE, ?MODULE, [],
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
Start = random:uniform(10000),
|
||||
send_loop(Pid, Start, Start + random:uniform(10000)),
|
||||
gm:leave(Pid),
|
||||
|
|
|
@ -44,9 +44,8 @@ terminate(Owner, _Reason) ->
|
|||
%% other
|
||||
|
||||
wile_e_coyote(Time, WriteUnit) ->
|
||||
{ok, Pid} = gm:start_link(?MODULE, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
self()),
|
||||
{ok, Pid} = gm:start_link(?MODULE, ?MODULE, self(),
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
receive joined -> ok end,
|
||||
timer:sleep(1000), %% wait for all to join
|
||||
timer:send_after(Time, stop),
|
||||
|
|
|
@ -77,9 +77,8 @@ test_member_death() ->
|
|||
with_two_members(
|
||||
fun (Pid, Pid2) ->
|
||||
{ok, Pid3} = gm:start_link(
|
||||
?MODULE, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
self()),
|
||||
?MODULE, ?MODULE, self(),
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
passed = receive_joined(Pid3, [Pid, Pid2, Pid3],
|
||||
timeout_joining_gm_group_3),
|
||||
passed = receive_birth(Pid, Pid3, timeout_waiting_for_birth_3_1),
|
||||
|
@ -131,14 +130,12 @@ test_broadcast_fun(Fun) ->
|
|||
with_two_members(Fun) ->
|
||||
ok = gm:create_tables(),
|
||||
|
||||
{ok, Pid} = gm:start_link(?MODULE, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
self()),
|
||||
{ok, Pid} = gm:start_link(?MODULE, ?MODULE, self(),
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
passed = receive_joined(Pid, [Pid], timeout_joining_gm_group_1),
|
||||
|
||||
{ok, Pid2} = gm:start_link(?MODULE, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
self()),
|
||||
{ok, Pid2} = gm:start_link(?MODULE, ?MODULE, self(),
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
passed = receive_joined(Pid2, [Pid, Pid2], timeout_joining_gm_group_2),
|
||||
passed = receive_birth(Pid, Pid2, timeout_waiting_for_birth_2),
|
||||
|
||||
|
|
|
@ -327,9 +327,8 @@ init([#amqqueue { name = QueueName } = Q, GM, DeathFun, DepthFun]) ->
|
|||
GM1 = case GM of
|
||||
undefined ->
|
||||
{ok, GM2} = gm:start_link(
|
||||
QueueName, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
[self()]),
|
||||
QueueName, ?MODULE, [self()],
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
receive {joined, GM2, _Members} ->
|
||||
ok
|
||||
end,
|
||||
|
|
|
@ -99,9 +99,8 @@ init(Q = #amqqueue { name = QName }) ->
|
|||
%% above.
|
||||
%%
|
||||
process_flag(trap_exit, true), %% amqqueue_process traps exits too.
|
||||
{ok, GM} = gm:start_link(QName, ?MODULE,
|
||||
fun rabbit_misc:execute_mnesia_transaction/1,
|
||||
[self()]),
|
||||
{ok, GM} = gm:start_link(QName, ?MODULE, [self()],
|
||||
fun rabbit_misc:execute_mnesia_transaction/1),
|
||||
receive {joined, GM} -> ok end,
|
||||
Self = self(),
|
||||
Node = node(),
|
||||
|
|
Loading…
Reference in New Issue