async-container 0.26.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/container/forked.rb +3 -3
- data/lib/async/container/group.rb +7 -1
- data/lib/async/container/threaded.rb +4 -2
- data/lib/async/container/version.rb +1 -1
- data/readme.md +9 -0
- data/releases.md +9 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c475605b174dc9677a89310e85b7ca28269b084469b51c6f7f5226ca39d26340
|
4
|
+
data.tar.gz: ccbdcaa3da1c785abdadefc3ece4ce6552ea6c418a0218229e04ab53c51b2637
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f17a77ff0978894a46b5b18b4ac7e2fc2bf451d13c2c4c4a94c122cc205df90b248007ad2b1d6d4655b89257bb94d745a57aa23ed833702f811afe62dc64261
|
7
|
+
data.tar.gz: 7415b0fb06ccaeea5645f0cc43e098f8ea1f684fc3cc51b1e5dd22dd1b3be68eba864af8f32fe93d960af3e6205a490453c48189730371a19cf0f873cb738155
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -235,7 +235,7 @@ module Async
|
|
235
235
|
# @returns [::Process::Status] The process exit status.
|
236
236
|
def wait(timeout = 0.1)
|
237
237
|
if @pid && @status.nil?
|
238
|
-
Console.debug(self, "Waiting for process to exit...",
|
238
|
+
Console.debug(self, "Waiting for process to exit...", child: {process_id: @pid}, timeout: timeout)
|
239
239
|
|
240
240
|
_, @status = ::Process.wait2(@pid, ::Process::WNOHANG)
|
241
241
|
|
@@ -245,7 +245,7 @@ module Async
|
|
245
245
|
_, @status = ::Process.wait2(@pid, ::Process::WNOHANG)
|
246
246
|
|
247
247
|
if @status.nil?
|
248
|
-
Console.warn(self
|
248
|
+
Console.warn(self, "Process is blocking, sending kill signal...", child: {process_id: @pid}, caller: caller_locations, timeout: timeout)
|
249
249
|
self.kill!
|
250
250
|
|
251
251
|
# Wait for the process to exit:
|
@@ -254,7 +254,7 @@ module Async
|
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
257
|
-
Console.debug(self, "Process exited.",
|
257
|
+
Console.debug(self, "Process exited.", child: {process_id: @pid, status: @status})
|
258
258
|
|
259
259
|
return @status
|
260
260
|
end
|
@@ -10,6 +10,12 @@ require_relative "error"
|
|
10
10
|
|
11
11
|
module Async
|
12
12
|
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
|
+
|
13
19
|
# Manages a group of running processes.
|
14
20
|
class Group
|
15
21
|
# Initialize an empty group.
|
@@ -153,7 +159,7 @@ module Async
|
|
153
159
|
# @parameter graceful [Boolean] Whether to send SIGINT first or skip directly to SIGTERM.
|
154
160
|
# @parameter interrupt_timeout [Numeric | Nil] Time to wait after SIGINT before escalating to SIGTERM.
|
155
161
|
# @parameter terminate_timeout [Numeric | Nil] Time to wait after SIGTERM before escalating to SIGKILL.
|
156
|
-
def stop(graceful = true, interrupt_timeout:
|
162
|
+
def stop(graceful = true, interrupt_timeout: INTERRUPT_TIMEOUT, terminate_timeout: TERMINATE_TIMEOUT)
|
157
163
|
case graceful
|
158
164
|
when true
|
159
165
|
# Use defaults.
|
@@ -222,10 +222,10 @@ module Async
|
|
222
222
|
# @returns [Status]
|
223
223
|
def wait(timeout = 0.1)
|
224
224
|
if @waiter
|
225
|
-
Console.debug(self, "Waiting for thread to exit...", timeout: timeout)
|
225
|
+
Console.debug(self, "Waiting for thread to exit...", child: {thread_id: @thread.object_id}, timeout: timeout)
|
226
226
|
|
227
227
|
unless @waiter.join(timeout)
|
228
|
-
Console.warn(self
|
228
|
+
Console.warn(self, "Thread is blocking, sending kill signal...", child: {thread_id: @thread.object_id}, caller: caller_locations, timeout: timeout)
|
229
229
|
self.kill!
|
230
230
|
@waiter.join
|
231
231
|
end
|
@@ -233,6 +233,8 @@ module Async
|
|
233
233
|
@waiter = nil
|
234
234
|
end
|
235
235
|
|
236
|
+
Console.debug(self, "Thread exited.", child: {thread_id: @thread.object_id, status: @status})
|
237
|
+
|
236
238
|
return @status
|
237
239
|
end
|
238
240
|
|
data/readme.md
CHANGED
@@ -26,6 +26,15 @@ Please see the [project documentation](https://socketry.github.io/async-containe
|
|
26
26
|
|
27
27
|
Please see the [project releases](https://socketry.github.io/async-container/releases/index) for all releases.
|
28
28
|
|
29
|
+
### v0.27.1
|
30
|
+
|
31
|
+
- Log caller and timeout when waiting on a child instance to exit, if it blocks.
|
32
|
+
|
33
|
+
### v0.27.0
|
34
|
+
|
35
|
+
- Increased default interrupt timeout and terminate timeout to 10 seconds each.
|
36
|
+
- Expose `ASYNC_CONTAINER_INTERRUPT_TIMEOUT` and `ASYNC_CONTAINER_TERMINATE_TIMEOUT` environment variables for configuring default timeouts.
|
37
|
+
|
29
38
|
### v0.26.0
|
30
39
|
|
31
40
|
- [Production Reliability Improvements](https://socketry.github.io/async-container/releases/index#production-reliability-improvements)
|
data/releases.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Releases
|
2
2
|
|
3
|
+
## v0.27.1
|
4
|
+
|
5
|
+
- Log caller and timeout when waiting on a child instance to exit, if it blocks.
|
6
|
+
|
7
|
+
## v0.27.0
|
8
|
+
|
9
|
+
- Increased default interrupt timeout and terminate timeout to 10 seconds each.
|
10
|
+
- Expose `ASYNC_CONTAINER_INTERRUPT_TIMEOUT` and `ASYNC_CONTAINER_TERMINATE_TIMEOUT` environment variables for configuring default timeouts.
|
11
|
+
|
3
12
|
## v0.26.0
|
4
13
|
|
5
14
|
### Production Reliability Improvements
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|