Skip to content

Commit be8b6c0

Browse files
samuel-williams-shopifyioquatix
authored andcommitted
Default to 10 seconds for interrupt and terminate timeout.
1 parent ed6ac00 commit be8b6c0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/async/container/group.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
module Async
1212
module Container
13+
# The default timeout for interrupting processes, before escalating to terminating.
14+
INTERRUPT_TIMEOUT = ENV.fetch("ASYNC_CONTAINER_INTERRUPT_TIMEOUT", 10).to_f
15+
16+
# The default timeout for terminating processes, before escalating to killing.
17+
TERMINATE_TIMEOUT = ENV.fetch("ASYNC_CONTAINER_TERMINATE_TIMEOUT", 10).to_f
18+
1319
# Manages a group of running processes.
1420
class Group
1521
# Initialize an empty group.
@@ -153,7 +159,7 @@ def kill
153159
# @parameter graceful [Boolean] Whether to send SIGINT first or skip directly to SIGTERM.
154160
# @parameter interrupt_timeout [Numeric | Nil] Time to wait after SIGINT before escalating to SIGTERM.
155161
# @parameter terminate_timeout [Numeric | Nil] Time to wait after SIGTERM before escalating to SIGKILL.
156-
def stop(graceful = true, interrupt_timeout: 1, terminate_timeout: 1)
162+
def stop(graceful = true, interrupt_timeout: INTERRUPT_TIMEOUT, terminate_timeout: TERMINATE_TIMEOUT)
157163
case graceful
158164
when true
159165
# Use defaults.

releases.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Releases
22

3+
## Unreleased
4+
5+
- Increased default interrupt timeout and terminate timeout to 10 seconds each.
6+
- Expose `ASYNC_CONTAINER_INTERRUPT_TIMEOUT` and `ASYNC_CONTAINER_TERMINATE_TIMEOUT` environment variables for configuring default timeouts.
7+
38
## v0.26.0
49

510
### Production Reliability Improvements

0 commit comments

Comments
 (0)