async-container 0.29.0 → 0.29.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: c768248159a5f1e95a387a176a66a4247e55034c08f7d2292a240f4566109a5b
4
- data.tar.gz: 577db3dc26ed07b2fcfce8b85351d44a790a7141548c7434d9f1bc59a7c8a035
3
+ metadata.gz: 3d92a0a4336ea40b938ef0b8b54c7dd695f8814df486fd7d80064dbb6a131722
4
+ data.tar.gz: f944972f872903ce0552b72e506888f84ad9dde40c980cbd4893f59019604eef
5
5
  SHA512:
6
- metadata.gz: 8cbc40f7cd5953f87db2d62bfbf31cf58e8f140fd13be99e7ecd217d1a6bc0953e8f48e3d6102fbd2da483d0833902047cf7d2d3e60ea2d8b5bc2105234399b2
7
- data.tar.gz: fa97dea49c6334f47a2a09bb86f478e1890085d31ac9b28ab6fbb67d438140eccb3ff7c0b82001f7f8759b8a33ee581f073467e8092a1546c04d974e703c176c
6
+ metadata.gz: 8ae6df190c3ea6e654604bc545f07e1b76af03c3ff02dd236997a9c09035c482b060244ba349d831f74138338d72be307b214c292915185035b38de173eb6b98
7
+ data.tar.gz: 4f7a6913143f38ec54a9f727f3bf1c738d2f7f79bd777a90fd4302689ae0c67c15faf528f1a171387a35a07cd9e168101d928ffe062749d5f0ab71e6b0e1a05f
checksums.yaml.gz.sig CHANGED
Binary file
@@ -91,7 +91,8 @@ module Async
91
91
  @group.running?
92
92
  end
93
93
 
94
- # Sleep until some state change occurs.
94
+ # Sleep until some state change occurs or the specified duration elapses.
95
+ #
95
96
  # @parameter duration [Numeric] the maximum amount of time to sleep for.
96
97
  def sleep(duration = nil)
97
98
  @group.sleep(duration)
@@ -140,7 +141,7 @@ module Async
140
141
  # Stop the children instances.
141
142
  # @parameter timeout [Boolean | Numeric] Whether to stop gracefully, or a specific timeout.
142
143
  def stop(timeout = true)
143
- Console.info(self, "Stopping container...", timeout: timeout, caller: caller_locations)
144
+ Console.debug(self, "Stopping container...", timeout: timeout)
144
145
  @running = false
145
146
  @group.stop(timeout)
146
147
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2025, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  module Async
7
7
  module Container
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2025, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
  # Copyright, 2020, by Olle Jonsson.
6
6
 
7
7
  require "tmpdir"
8
8
  require "socket"
9
9
  require "securerandom"
10
+ require "set"
10
11
 
11
12
  module Async
12
13
  module Container
@@ -15,6 +16,20 @@ module Async
15
16
  class Server
16
17
  MAXIMUM_MESSAGE_SIZE = 4096
17
18
 
19
+ # Fields from the systemd sd_notify protocol that use "0"/"1" for boolean values.
20
+ # See: https://www.freedesktop.org/software/systemd/man/sd_notify.html
21
+ BOOLEAN_FIELDS = Set[
22
+ :ready,
23
+ :reloading,
24
+ :stopping,
25
+ :fdstore,
26
+ :fdstoreremove,
27
+ :fdpoll,
28
+ :barrier,
29
+ :watchdog, # Note: also accepts "trigger" as a string value.
30
+ :healthy, # Extension: not in standard systemd protocol.
31
+ ].freeze
32
+
18
33
  # Parse a message, according to the `sd_notify` protocol.
19
34
  #
20
35
  # @parameter message [String] The message to parse.
@@ -29,11 +44,15 @@ module Async
29
44
 
30
45
  key = key.downcase.to_sym
31
46
 
32
- if value == "0"
33
- value = false
34
- elsif value == "1"
35
- value = true
47
+ if BOOLEAN_FIELDS.include?(key)
48
+ # Convert "0"/"1" to boolean for known systemd boolean fields:
49
+ if value == "0"
50
+ value = false
51
+ elsif value == "1"
52
+ value = true
53
+ end
36
54
  elsif key == :errno and value =~ /\A\-?\d+\z/
55
+ # Convert errno to integer:
37
56
  value = Integer(value)
38
57
  end
39
58
 
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2025, by Samuel Williams.
4
+ # Copyright, 2017-2026, by Samuel Williams.
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.29.0"
8
+ VERSION = "0.29.1"
9
9
  end
10
10
  end
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.29.0
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file