diff options
author | Tristan Sloughter <[email protected]> | 2019-08-19 10:07:46 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-19 10:07:46 -0600 |
commit | 7d70b98ee10fa559c926c926eb6a80e3b582043e (patch) | |
tree | 9d7612abb40ce70b152b9f36674591af8097b687 /priv/templates | |
parent | 6ba95994c5c070a774cd248286e2b4b4e21274d0 (diff) | |
parent | e57ed905fc3dd6f81326a61ee18f1958933d4091 (diff) | |
download | relx-7d70b98ee10fa559c926c926eb6a80e3b582043e.tar.gz relx-7d70b98ee10fa559c926c926eb6a80e3b582043e.tar.bz2 relx-7d70b98ee10fa559c926c926eb6a80e3b582043e.zip |
Merge pull request #745 from evanmcc/fix-hardcoded-timeout
add configurable timeouts to nodetool
Diffstat (limited to 'priv/templates')
-rw-r--r-- | priv/templates/nodetool | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/priv/templates/nodetool b/priv/templates/nodetool index 9e24f32..f460962 100644 --- a/priv/templates/nodetool +++ b/priv/templates/nodetool @@ -22,20 +22,32 @@ main(Args) -> halt(1) end, + Timeout = + case os:getenv("NODETOOL_TIMEOUT") of + false -> + 60000; + StrVal -> + try + list_to_integer(StrVal) + catch _:_ -> + 60000 + end + end, + case RestArgs of ["ping"] -> %% If we got this far, the node already responsed to a ping, so just dump %% a "pong" io:format("pong\n"); ["stop"] -> - io:format("~p\n", [rpc:call(TargetNode, init, stop, [], 60000)]); + io:format("~p\n", [rpc:call(TargetNode, init, stop, [], Timeout)]); ["restart"] -> - io:format("~p\n", [rpc:call(TargetNode, init, restart, [], 60000)]); + io:format("~p\n", [rpc:call(TargetNode, init, restart, [], Timeout)]); ["reboot"] -> - io:format("~p\n", [rpc:call(TargetNode, init, reboot, [], 60000)]); + io:format("~p\n", [rpc:call(TargetNode, init, reboot, [], Timeout)]); ["rpc", Module, Function | RpcArgs] -> case rpc:call(TargetNode, list_to_atom(Module), list_to_atom(Function), - [RpcArgs], 60000) of + [RpcArgs], Timeout) of ok -> ok; {badrpc, Reason} -> @@ -46,7 +58,7 @@ main(Args) -> end; ["rpcterms", Module, Function | ArgsAsString] -> case rpc:call(TargetNode, list_to_atom(Module), list_to_atom(Function), - consult(lists:flatten(ArgsAsString)), 60000) of + consult(lists:flatten(ArgsAsString)), Timeout) of {badrpc, Reason} -> io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]), halt(1); |