Permalink
Browse files

allow infinity timeout

  • Loading branch information...
vasspilka committed Nov 13, 2018
1 parent e639a15 commit 8513a313aa895a920dce3096eab3d73ae6094453
Showing with 9 additions and 1 deletion.
  1. +1 −1 lib/commanded/aggregates/aggregate.ex
  2. +8 −0 test/commands/command_timeout_test.exs
@@ -111,7 +111,7 @@ defmodule Commanded.Aggregates.Aggregate do
"""
def execute(aggregate_module, aggregate_uuid, %ExecutionContext{} = context, timeout \\ 5_000)
when is_atom(aggregate_module) and is_binary(aggregate_uuid) and is_number(timeout) do
when is_atom(aggregate_module) and is_binary(aggregate_uuid) and is_number(timeout) or timeout == :infinity do
GenServer.call(
via_name(aggregate_module, aggregate_uuid),
{:execute_command, context},
@@ -23,4 +23,12 @@ defmodule Commanded.Commands.CommandTimeoutTest do
2_000
)
end
test "should accept :infinity as timeout option" do
:ok =
TimeoutRouter.dispatch(
%TimeoutCommand{aggregate_uuid: UUID.uuid4(), sleep_in_ms: 1},
:infinity
)
end
end

0 comments on commit 8513a31

Please sign in to comment.