|
116 | 116 | forget_cluster_node, rename_cluster_node, cluster_status, status,
|
117 | 117 | environment, eval, force_boot, help, node_health_check, hipe_compile]).
|
118 | 118 |
|
| 119 | +%% [Command | {Command, DefaultTimeoutInMilliSeconds}] |
119 | 120 | -define(COMMANDS_WITH_TIMEOUT,
|
120 | 121 | [list_user_permissions, list_policies, list_queues, list_exchanges,
|
121 | 122 | list_bindings, list_connections, list_channels, list_consumers,
|
@@ -152,7 +153,7 @@ start() ->
|
152 | 153 | end
|
153 | 154 | end,
|
154 | 155 | try
|
155 |
| - T = case get_timeout(Opts) of |
| 156 | + T = case get_timeout(Command, Opts) of |
156 | 157 | {ok, Timeout} ->
|
157 | 158 | Timeout;
|
158 | 159 | {error, _} ->
|
@@ -187,8 +188,23 @@ print_report0(Node, {Module, InfoFun, KeysFun}, VHostArg) ->
|
187 | 188 | end,
|
188 | 189 | io:nl().
|
189 | 190 |
|
190 |
| -get_timeout(Opts) -> |
191 |
| - parse_timeout(proplists:get_value(?TIMEOUT_OPT, Opts, ?RPC_TIMEOUT)). |
| 191 | +get_timeout(Command, Opts) -> |
| 192 | + Default = case proplists:lookup(Command, ?COMMANDS_WITH_TIMEOUT) of |
| 193 | + none -> |
| 194 | + infinity; |
| 195 | + {Command, true} -> |
| 196 | + ?RPC_TIMEOUT; |
| 197 | + {Command, D} -> |
| 198 | + D |
| 199 | + end, |
| 200 | + Result = case proplists:get_value(?TIMEOUT_OPT, Opts, Default) of |
| 201 | + use_default -> |
| 202 | + parse_timeout(Default); |
| 203 | + Value -> |
| 204 | + parse_timeout(Value) |
| 205 | + end, |
| 206 | + Result. |
| 207 | + |
192 | 208 |
|
193 | 209 | parse_number(N) when is_list(N) ->
|
194 | 210 | try list_to_integer(N) of
|
@@ -234,11 +250,11 @@ do_action(Command, Node, Args, Opts, Inform, Timeout) ->
|
234 | 250 | false ->
|
235 | 251 | case ensure_app_running(Node) of
|
236 | 252 | ok ->
|
237 |
| - case lists:member(Command, ?COMMANDS_WITH_TIMEOUT) of |
238 |
| - true -> |
| 253 | + case proplists:lookup(Command, ?COMMANDS_WITH_TIMEOUT) of |
| 254 | + {Command, _} -> |
239 | 255 | announce_timeout(Timeout, Inform),
|
240 | 256 | action(Command, Node, Args, Opts, Inform, Timeout);
|
241 |
| - false -> |
| 257 | + none -> |
242 | 258 | action(Command, Node, Args, Opts, Inform)
|
243 | 259 | end;
|
244 | 260 | E -> E
|
|
0 commit comments