mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-05 14:51:05 +02:00
increase rehash timeout to 30 seconds; increase hashing points
This commit is contained in:
parent
bde3bce1e7
commit
4a6fc46713
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
-define(HASHTBL, nodes_hash).
|
-define(HASHTBL, nodes_hash).
|
||||||
-define(HASHTBL_NEW, nodes_hash_new).
|
-define(HASHTBL_NEW, nodes_hash_new).
|
||||||
-define(POINTS, 16).
|
-define(POINTS, 64).
|
||||||
-define(REHASH_TIMEOUT, 5000).
|
-define(REHASH_TIMEOUT, 30000).
|
||||||
|
|
||||||
-record(state, {}).
|
-record(state, {}).
|
||||||
|
|
||||||
|
@ -555,7 +555,15 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod, _Time,
|
|||||||
loop(Parent, Name, NStateName, NStateData, Mod, Time1, [],
|
loop(Parent, Name, NStateName, NStateData, Mod, Time1, [],
|
||||||
Limits, Queue, QueueLen);
|
Limits, Queue, QueueLen);
|
||||||
{migrate, NStateData, {Node, M, F, A}, Time1} ->
|
{migrate, NStateData, {Node, M, F, A}, Time1} ->
|
||||||
Reason = case catch rpc:call(Node, M, F, A, 5000) of
|
RPCTimeout = if Time1 == 0 ->
|
||||||
|
%% We don't care about a delay,
|
||||||
|
%% so we set it one minute
|
||||||
|
60000;
|
||||||
|
true ->
|
||||||
|
Time1
|
||||||
|
end,
|
||||||
|
Now = now(),
|
||||||
|
Reason = case catch rpc:call(Node, M, F, A, RPCTimeout) of
|
||||||
{badrpc, _} = Err ->
|
{badrpc, _} = Err ->
|
||||||
{migration_error, Err};
|
{migration_error, Err};
|
||||||
{'EXIT', _} = Err ->
|
{'EXIT', _} = Err ->
|
||||||
@ -565,7 +573,9 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod, _Time,
|
|||||||
{ok, Clone} ->
|
{ok, Clone} ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
MRef = erlang:monitor(process, Clone),
|
MRef = erlang:monitor(process, Clone),
|
||||||
TRef = erlang:start_timer(Time1, self(), timeout),
|
NowDiff = timer:now_diff(now(), Now),
|
||||||
|
TimeLeft = lists:max([Time1 - NowDiff, 0]) div 1000,
|
||||||
|
TRef = erlang:start_timer(TimeLeft, self(), timeout),
|
||||||
relay_messages(MRef, TRef, Clone, Queue);
|
relay_messages(MRef, TRef, Clone, Queue);
|
||||||
Reply ->
|
Reply ->
|
||||||
{migration_error, {bad_reply, Reply}}
|
{migration_error, {bad_reply, Reply}}
|
||||||
@ -608,7 +618,15 @@ handle_msg(Msg, Parent, Name, StateName, StateData,
|
|||||||
loop(Parent, Name, NStateName, NStateData,
|
loop(Parent, Name, NStateName, NStateData,
|
||||||
Mod, Time1, Debug1, Limits, Queue, QueueLen);
|
Mod, Time1, Debug1, Limits, Queue, QueueLen);
|
||||||
{migrate, NStateData, {Node, M, F, A}, Time1} ->
|
{migrate, NStateData, {Node, M, F, A}, Time1} ->
|
||||||
Reason = case catch rpc:call(Node, M, F, A, Time1) of
|
RPCTimeout = if Time1 == 0 ->
|
||||||
|
%% We don't care about a delay,
|
||||||
|
%% so we set it one minute
|
||||||
|
60000;
|
||||||
|
true ->
|
||||||
|
Time1
|
||||||
|
end,
|
||||||
|
Now = now(),
|
||||||
|
Reason = case catch rpc:call(Node, M, F, A, RPCTimeout) of
|
||||||
{badrpc, R} ->
|
{badrpc, R} ->
|
||||||
{migration_error, R};
|
{migration_error, R};
|
||||||
{'EXIT', R} ->
|
{'EXIT', R} ->
|
||||||
@ -618,7 +636,9 @@ handle_msg(Msg, Parent, Name, StateName, StateData,
|
|||||||
{ok, Clone} ->
|
{ok, Clone} ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
MRef = erlang:monitor(process, Clone),
|
MRef = erlang:monitor(process, Clone),
|
||||||
TRef = erlang:start_timer(Time1, self(), timeout),
|
NowDiff = timer:now_diff(now(), Now),
|
||||||
|
TimeLeft = lists:max([Time1 - NowDiff, 0]) div 1000,
|
||||||
|
TRef = erlang:start_timer(TimeLeft, self(), timeout),
|
||||||
relay_messages(MRef, TRef, Clone, Queue);
|
relay_messages(MRef, TRef, Clone, Queue);
|
||||||
Reply ->
|
Reply ->
|
||||||
{migration_error, {bad_reply, Reply}}
|
{migration_error, {bad_reply, Reply}}
|
||||||
|
Loading…
Reference in New Issue
Block a user