async-container 0.36.0 → 0.37.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b7c79f742eb9268bd10341606d71dcb98855a5112ba7022d35a38618185c3ea
4
- data.tar.gz: 37a766f7e70db3d39ae22af3a4c1e0edfc92470f7d34bc0030791d3f23d8feea
3
+ metadata.gz: 62299eb75e389a8fcf1f7b179cdbc7803a0ecebc4fe41fb6e1f1023b702b5573
4
+ data.tar.gz: d13e79527be255c01311c07979eaed4ca6c22d18c36b51a2ea2644617975562c
5
5
  SHA512:
6
- metadata.gz: 6d538e1db3f7483707fb77b7012b293eb51e89ae7c25be6f8af738e0e5ae0f43528c2e437a322f1180fe12425560280341428e5b4264eeacda2396766b687c46
7
- data.tar.gz: 2f405c30b3037e15c132e390bb3df865a2bfbe191d665511d9321c4ef0777245ef6146f914134addfece8fc0b279f194621bfd70c1952738b0c6e5bb461ecac8
6
+ metadata.gz: d819e162498afd6c99125e525145fe981ceccb6d6bed77da0d01ea586f91052a24666bcd37676d66662d52637db0827536d61669e4ffee816de57d32ba621a56
7
+ data.tar.gz: a01f2d1a4e22ac3152392bbbdc42475ab333d1cc4605d3fb20711f495e889a2fd91de77d1bdfed580267d5d49d932b74f1b491a584551bd79b55a4cf285b474e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -12,6 +12,18 @@ require_relative "policy"
12
12
 
13
13
  module Async
14
14
  module Container
15
+ # The default graceful stop policy for controllers.
16
+ GRACEFUL_STOP = ENV.fetch("ASYNC_CONTAINER_GRACEFUL_STOP", "true").then do |value|
17
+ case value
18
+ when "true"
19
+ true # Default timeout for graceful termination.
20
+ when "false"
21
+ false # Immediately kill the processes.
22
+ else
23
+ value.to_f
24
+ end
25
+ end
26
+
15
27
  # Manages the life-cycle of one or more containers in order to support a persistent system.
16
28
  # e.g. a web server, job server or some other long running system.
17
29
  class Controller
@@ -23,7 +35,7 @@ module Async
23
35
 
24
36
  # Initialize the controller.
25
37
  # @parameter notify [Notify::Client] A client used for process readiness notifications.
26
- def initialize(notify: Notify.open!, container_class: Container, graceful_stop: true)
38
+ def initialize(notify: Notify.open!, container_class: Container, graceful_stop: GRACEFUL_STOP)
27
39
  @notify = notify
28
40
  @container_class = container_class
29
41
  @graceful_stop = graceful_stop
@@ -10,19 +10,7 @@ require_relative "error"
10
10
 
11
11
  module Async
12
12
  module Container
13
- # The default timeout for terminating processes, before escalating to killing.
14
- GRACEFUL_TIMEOUT = ENV.fetch("ASYNC_CONTAINER_GRACEFUL_TIMEOUT", "true").then do |value|
15
- case value
16
- when "true"
17
- true # Default timeout for graceful termination.
18
- when "false"
19
- false # Immediately kill the processes.
20
- else
21
- value.to_f
22
- end
23
- end
24
-
25
- # The default timeout for graceful termination.
13
+ # The default timeout for graceful termination, used when the `graceful` argument is true.
26
14
  DEFAULT_GRACEFUL_TIMEOUT = 10.0
27
15
 
28
16
  # Manages a group of running processes.
@@ -163,7 +151,7 @@ module Async
163
151
  # If `graceful` is false, skip the SIGINT phase and go directly to SIGKILL.
164
152
  #
165
153
  # @parameter graceful [Boolean | Numeric] Whether to send SIGINT first or skip directly to SIGKILL.
166
- def stop(graceful = GRACEFUL_TIMEOUT)
154
+ def stop(graceful = true)
167
155
  Console.debug(self, "Stopping all processes...", graceful: graceful)
168
156
 
169
157
  # If a timeout is specified, interrupt the children first:
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.36.0"
8
+ VERSION = "0.37.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -28,6 +28,10 @@ Please see the [project documentation](https://socketry.github.io/async-containe
28
28
 
29
29
  Please see the [project releases](https://socketry.github.io/async-container/releases/index) for all releases.
30
30
 
31
+ ### v0.37.0
32
+
33
+ - Rename `ASYNC_CONTAINER_GRACEFUL_TIMEOUT` to `ASYNC_CONTAINER_GRACEFUL_STOP` and apply it at the controller level as `GRACEFUL_STOP`. `Group#stop` now only applies the shutdown policy it is given.
34
+
31
35
  ### v0.36.0
32
36
 
33
37
  - Forked containers now fork child processes from a short-lived thread, reducing inherited scheduler and parent stack state in children.
@@ -64,10 +68,6 @@ Please see the [project releases](https://socketry.github.io/async-container/rel
64
68
 
65
69
  - Add `Policy#make_statistics` to allow policies to customize statistics initialization.
66
70
 
67
- ### v0.32.1
68
-
69
- - Expose `Async::Container::Controller` `#notify`, `#container_class`, and `#graceful_stop` for testing.
70
-
71
71
  ## Contributing
72
72
 
73
73
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.37.0
4
+
5
+ - Rename `ASYNC_CONTAINER_GRACEFUL_TIMEOUT` to `ASYNC_CONTAINER_GRACEFUL_STOP` and apply it at the controller level as `GRACEFUL_STOP`. `Group#stop` now only applies the shutdown policy it is given.
6
+
3
7
  ## v0.36.0
4
8
 
5
9
  - Forked containers now fork child processes from a short-lived thread, reducing inherited scheduler and parent stack state in children.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.37.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file