Skip to content

Commit 6ff2494

Browse files
committed
Merge pull request #98 from basho/bugfix/crash-exit-code
Respect shutdown_on_error flag on driver crash
2 parents 8bd7027 + 154e922 commit 6ff2494

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/basho_bench_worker.erl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,21 @@ worker_next_op(State) ->
263263
(catch (State#state.driver):terminate({'EXIT', Reason}, State#state.driver_state)),
264264

265265
?DEBUG("Driver ~p crashed: ~p\n", [State#state.driver, Reason]),
266-
crash;
266+
case State#state.shutdown_on_error of
267+
true ->
268+
%% Yes, I know this is weird, but currently this
269+
%% is how you tell Basho Bench to return a
270+
%% non-zero exit status. Ideally this would all
271+
%% be done in the `handle_info' callback where it
272+
%% would check `Reason' and `shutdown_on_error'.
273+
%% Then I wouldn't have to return a bullshit "ok"
274+
%% here.
275+
erlang:send_after(500, basho_bench,
276+
{shutdown, "Shutdown on errors requested", 2}),
277+
{ok, State};
278+
false ->
279+
crash
280+
end;
267281

268282
{stop, Reason} ->
269283
%% Driver (or something within it) has requested that this worker

0 commit comments

Comments
 (0)