async-container-supervisor 0.9.1 → 0.9.2
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/bake/async/container/supervisor.rb +7 -1
- data/lib/async/container/supervisor/client.rb +6 -2
- data/lib/async/container/supervisor/connection.rb +3 -2
- data/lib/async/container/supervisor/version.rb +1 -1
- data/lib/async/container/supervisor/worker.rb +1 -1
- 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: 9013912b7ef22165d93ebf5f6958d26be67b99f601a28b3ac6e7208fc4e8db54
|
|
4
|
+
data.tar.gz: 2de566c74dc9fabad2bc5ccb0f0bf329581860fbb8e27f14944cefecfacef9b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bde00386e4f3faa439e149b872bb22075725f05235769a1b5084760f059e0e1aed7a669dec9232125aa5053b1afdf09a016c444a16918c4da92210169e9e50b0
|
|
7
|
+
data.tar.gz: 844be24d31216db2cdfb978aaf888d15be0982e3211c384e7239bd564ef08880d5d870d887084319232ce6760594b37974623c11c5686c433c92ae3de960e67d
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -44,7 +44,13 @@ def memory_sample(duration: 10, connection_id:)
|
|
|
44
44
|
operation = {do: :memory_sample, duration: duration}
|
|
45
45
|
|
|
46
46
|
# Use the forward operation to proxy the request to a worker:
|
|
47
|
-
|
|
47
|
+
response = connection.call(do: :forward, operation: operation, connection_id: connection_id)
|
|
48
|
+
|
|
49
|
+
if response && response.key?(:data)
|
|
50
|
+
JSON.parse(response[:data], symbolize_names: true)
|
|
51
|
+
else
|
|
52
|
+
response
|
|
53
|
+
end
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
|
|
@@ -48,11 +48,11 @@ module Async
|
|
|
48
48
|
|
|
49
49
|
# Run the client in a loop, reconnecting if necessary.
|
|
50
50
|
def run
|
|
51
|
-
Async(annotation: "Supervisor Client", transient: true) do
|
|
51
|
+
Async(annotation: "Supervisor Client", transient: true) do |task|
|
|
52
52
|
loop do
|
|
53
53
|
connection = connect!
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
connected_task = task.async do
|
|
56
56
|
connected!(connection)
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -61,6 +61,10 @@ module Async
|
|
|
61
61
|
Console.error(self, "Connection failed:", exception: error)
|
|
62
62
|
sleep(rand)
|
|
63
63
|
ensure
|
|
64
|
+
# Ensure any tasks that were created during connection are stopped:
|
|
65
|
+
connected_task&.stop
|
|
66
|
+
|
|
67
|
+
# Close the connection itself:
|
|
64
68
|
connection&.close
|
|
65
69
|
end
|
|
66
70
|
end
|
|
@@ -253,8 +253,9 @@ module Async
|
|
|
253
253
|
#
|
|
254
254
|
# @parameter message [Hash] The message to write.
|
|
255
255
|
def write(**message)
|
|
256
|
-
|
|
257
|
-
@stream.
|
|
256
|
+
raise IOError, "Connection is closed!" unless @stream
|
|
257
|
+
@stream&.write(JSON.dump(message) << "\n")
|
|
258
|
+
@stream&.flush # it is possible for @stream to become nil after the write call
|
|
258
259
|
end
|
|
259
260
|
|
|
260
261
|
# Read a message from the connection stream.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|