async-container 0.31.1 → 0.32.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46675ed8724779375aeccabec88625bb5f404c7f3ace7348c89acd5809133d8f
4
- data.tar.gz: 697d47779954d8856ed75be18c60cb4907fc119c3bcbdecdbb95dcf2d6154d12
3
+ metadata.gz: 77daf5246650362c76300eb71c5cf11459ff18967e273ba5de5ec6da3816a0f7
4
+ data.tar.gz: 9083168708fbce12c26900c2f4fa725845db8c67d7c94016c48ad3adbbdb5b5b
5
5
  SHA512:
6
- metadata.gz: e3151ea8a4abeaef64fa4b884587b0d0dd4a85ad8e041d5c912762bde0816ab4415e4f8ed7725f86606923f13e6630810e81ae3d74bfdfe4b92b1575ab8b948c
7
- data.tar.gz: 6e07e869a01ecf5039a07de3a9b4a0ae1fce59d0bf498a9faadc3e94d4c3b6dc3bfa049ea166d5efc766e0a3bf4328f7c05f36a685e0acedcf078baa20887315
6
+ metadata.gz: d293fd77c34c01ca982bdaf3be8f1c8216eed1552364b036782ecd12c259053270e837a95027374c9e8973d590043329bd00b31d1efe33743f0e5bf0e8af89a8
7
+ data.tar.gz: 7a7073417f66670f9bc686816bfdf35a290f3bc590a9396b1465f6dd1a7c2f27a679145dbbd487c2547ae69d0ae440f65b85a5d7fc63f72cb4cba5df1ea824ed
checksums.yaml.gz.sig CHANGED
Binary file
@@ -24,19 +24,30 @@ module Async
24
24
  # Initialize the controller.
25
25
  # @parameter notify [Notify::Client] A client used for process readiness notifications.
26
26
  def initialize(notify: Notify.open!, container_class: Container, graceful_stop: true)
27
- @container = nil
27
+ @notify = notify
28
28
  @container_class = container_class
29
+ @graceful_stop = graceful_stop
29
30
 
30
- @notify = notify
31
+ @container = nil
31
32
  @signals = {}
32
33
 
33
34
  self.trap(SIGHUP) do
34
35
  self.restart
35
36
  end
36
-
37
- @graceful_stop = graceful_stop
38
37
  end
39
38
 
39
+ # The notify client used by the controller.
40
+ attr :notify
41
+
42
+ # The container class used by the controller.
43
+ attr :container_class
44
+
45
+ # The graceful stop flag used by the controller.
46
+ attr :graceful_stop
47
+
48
+ # The current container being managed by the controller.
49
+ attr :container
50
+
40
51
  # The state of the controller.
41
52
  # @returns [String]
42
53
  def state_string
@@ -60,9 +71,6 @@ module Async
60
71
  @signals[signal] = block
61
72
  end
62
73
 
63
- # The current container being managed by the controller.
64
- attr :container
65
-
66
74
  # Create a policy for managing child lifecycle events.
67
75
  # Can be overridden by a sub-class to provide a custom policy.
68
76
  # @returns [Policy] The policy to use for the container.
@@ -271,7 +271,7 @@ module Async
271
271
 
272
272
  # Notify policy of exit (after statistics are updated):
273
273
  begin
274
- @policy.child_exit(self, child, status: status, name: name, key: key)
274
+ @policy.child_exit(self, child, status, name: name, key: key)
275
275
  rescue => error
276
276
  Console.error(self, "Policy error in child_exit!", exception: error)
277
277
  end
@@ -12,7 +12,8 @@ module Async
12
12
  # @parameter child [Child] The child process.
13
13
  # @parameter name [String] The name of the child.
14
14
  # @parameter key [Symbol] An optional key for the child.
15
- def child_spawn(container, child, name:, key:)
15
+ # @parameter options [Hash] Additional options for future extensibility.
16
+ def child_spawn(container, child, name:, key:, **options)
16
17
  end
17
18
 
18
19
  # Called when a child exits.
@@ -21,7 +22,8 @@ module Async
21
22
  # @parameter status [Process::Status] The exit status.
22
23
  # @parameter name [String] The name of the child.
23
24
  # @parameter key [Symbol] An optional key for the child.
24
- def child_exit(container, child, status:, name:, key:)
25
+ # @parameter options [Hash] Additional options for future extensibility.
26
+ def child_exit(container, child, status, name:, key:, **options)
25
27
  end
26
28
 
27
29
  # Called when a health check fails.
@@ -30,8 +32,9 @@ module Async
30
32
  # @parameter child [Child] The child process.
31
33
  # @parameter age [Numeric] How long the child has been running.
32
34
  # @parameter timeout [Numeric] The health check timeout that was exceeded.
33
- def health_check_failed(container, child, age:, timeout:)
34
- Console.warn(container, "Health check failed!", child: child, age: age, timeout: timeout)
35
+ # @parameter options [Hash] Additional options for future extensibility.
36
+ def health_check_failed(container, child, age:, timeout:, **options)
37
+ Console.warn(self, "Health check failed!", child: child, age: age, timeout: timeout)
35
38
  child.kill!
36
39
  end
37
40
 
@@ -41,8 +44,9 @@ module Async
41
44
  # @parameter child [Child] The child process.
42
45
  # @parameter age [Numeric] How long the child has been running.
43
46
  # @parameter timeout [Numeric] The startup timeout that was exceeded.
44
- def startup_failed(container, child, age:, timeout:)
45
- Console.warn(container, "Startup failed!", child: child, age: age, timeout: timeout)
47
+ # @parameter options [Hash] Additional options for future extensibility.
48
+ def startup_failed(container, child, age:, timeout:, **options)
49
+ Console.warn(self, "Startup failed!", child: child, age: age, timeout: timeout)
46
50
  child.kill!
47
51
  end
48
52
 
@@ -20,6 +20,9 @@ module Async
20
20
  @last_update = Array.new(@window, 0)
21
21
  end
22
22
 
23
+ # The time window in seconds for rate calculations.
24
+ attr :window
25
+
23
26
  # Get the current time in seconds.
24
27
  # @returns [Integer] The current monotonic time in seconds.
25
28
  def now
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.31.1"
8
+ VERSION = "0.32.1"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -28,6 +28,15 @@ 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.32.1
32
+
33
+ - Expose `Async::Container::Controller` `#notify`, `#container_class`, and `#graceful_stop` for testing.
34
+
35
+ ### v0.32.0
36
+
37
+ - Minor **breaking** changes to `Async::Container::Policy` interface.
38
+ - Expose `Async::Container::Statistics::Rate#window`.
39
+
31
40
  ### v0.31.0
32
41
 
33
42
  - Introduce `Async::Container::Policy` for managing child lifecycle events and implementing custom failure handling strategies.
@@ -65,15 +74,6 @@ Please see the [project releases](https://socketry.github.io/async-container/rel
65
74
 
66
75
  - More logging, especially around failure cases.
67
76
 
68
- ### v0.27.1
69
-
70
- - Log caller and timeout when waiting on a child instance to exit, if it blocks.
71
-
72
- ### v0.27.0
73
-
74
- - Increased default interrupt timeout and terminate timeout to 10 seconds each.
75
- - Expose `ASYNC_CONTAINER_INTERRUPT_TIMEOUT` and `ASYNC_CONTAINER_TERMINATE_TIMEOUT` environment variables for configuring default timeouts.
76
-
77
77
  ## Contributing
78
78
 
79
79
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Releases
2
2
 
3
+ ## v0.32.1
4
+
5
+ - Expose `Async::Container::Controller` `#notify`, `#container_class`, and `#graceful_stop` for testing.
6
+
7
+ ## v0.32.0
8
+
9
+ - Minor **breaking** changes to `Async::Container::Policy` interface.
10
+ - Expose `Async::Container::Statistics::Rate#window`.
11
+
3
12
  ## v0.31.0
4
13
 
5
14
  - Introduce `Async::Container::Policy` for managing child lifecycle events and implementing custom failure handling strategies.
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.31.1
4
+ version: 0.32.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file