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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/container/generic.rb +3 -2
- data/lib/async/container/notify/client.rb +1 -1
- data/lib/async/container/notify/server.rb +24 -5
- data/lib/async/container/version.rb +2 -2
- 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: 3d92a0a4336ea40b938ef0b8b54c7dd695f8814df486fd7d80064dbb6a131722
|
|
4
|
+
data.tar.gz: f944972f872903ce0552b72e506888f84ad9dde40c980cbd4893f59019604eef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
144
|
+
Console.debug(self, "Stopping container...", timeout: timeout)
|
|
144
145
|
@running = false
|
|
145
146
|
@group.stop(timeout)
|
|
146
147
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2020-
|
|
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
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|