Skip to content

Commit b4afce8

Browse files
committed
Harden cross-host state endpoints
1 parent 2ea5cce commit b4afce8

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/shuttle/poller.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ defmodule Shuttle.Poller do
4444
@default_heartbeat_interval_ms 5_000
4545
@default_stall_timeout_ms 300_000
4646
@dispatch_call_timeout_ms 30_000
47+
@orchestrator_state_call_timeout_ms 30_000
4748
@continuation_retry_delay_ms 1_000
4849
@failure_retry_base_ms 10_000
4950
@default_max_retry_backoff_ms 300_000
@@ -159,7 +160,7 @@ defmodule Shuttle.Poller do
159160

160161
@spec orchestrator_state(GenServer.server()) :: map()
161162
def orchestrator_state(server) do
162-
GenServer.call(server, :orchestrator_state)
163+
GenServer.call(server, :orchestrator_state, @orchestrator_state_call_timeout_ms)
163164
end
164165

165166
@doc """

lib/shuttle/runner.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ defmodule Shuttle.Runner do
1010

1111
defmodule Default do
1212
@behaviour Shuttle.Runner
13+
1314
def cmd(command, args, opts) do
1415
System.cmd(command, args, opts)
16+
rescue
17+
e in ErlangError ->
18+
case e.original do
19+
:enoent -> {"#{command}: command not found", 127}
20+
_ -> reraise e, __STACKTRACE__
21+
end
1522
end
1623
end
1724
end

0 commit comments

Comments
 (0)