async-container 0.27.1 → 0.27.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c475605b174dc9677a89310e85b7ca28269b084469b51c6f7f5226ca39d26340
4
- data.tar.gz: ccbdcaa3da1c785abdadefc3ece4ce6552ea6c418a0218229e04ab53c51b2637
3
+ metadata.gz: 7d43fc927cb1564c1ed256976873b66245386fe54d11467935184c1f38da9d96
4
+ data.tar.gz: 3738e9b3009bd87388fe23c34085d99a4ba384fe8ef274465ec732a8398f6b7b
5
5
  SHA512:
6
- metadata.gz: 1f17a77ff0978894a46b5b18b4ac7e2fc2bf451d13c2c4c4a94c122cc205df90b248007ad2b1d6d4655b89257bb94d745a57aa23ed833702f811afe62dc64261
7
- data.tar.gz: 7415b0fb06ccaeea5645f0cc43e098f8ea1f684fc3cc51b1e5dd22dd1b3be68eba864af8f32fe93d960af3e6205a490453c48189730371a19cf0f873cb738155
6
+ metadata.gz: 14700cf9cb8952affd49569383348715fa357660b809f033a1a0d345a03f3b16145ec868b07022df1bece5224008a49ce78441d86113ef18c94530247fadf104
7
+ data.tar.gz: 7665c5a66280b04bd835e9708e81fff08ab5116ab07886fae1aa3c3b155bef6011167d10bcdb63b08c3a877d5df795dd3901740a0e46ac0a433ff7cf024feac1
checksums.yaml.gz.sig CHANGED
Binary file
@@ -91,11 +91,11 @@ module Async
91
91
  # Start the container unless it's already running.
92
92
  def start
93
93
  unless @container
94
- Console.info(self) {"Controller starting..."}
94
+ Console.info(self, "Controller starting...")
95
95
  self.restart
96
96
  end
97
97
 
98
- Console.info(self) {"Controller started..."}
98
+ Console.info(self, "Controller started...")
99
99
  end
100
100
 
101
101
  # Stop the container if it's running.
@@ -111,9 +111,9 @@ module Async
111
111
  if @container
112
112
  @notify&.restarting!
113
113
 
114
- Console.debug(self) {"Restarting container..."}
114
+ Console.info(self, "Restarting container...")
115
115
  else
116
- Console.debug(self) {"Starting container..."}
116
+ Console.info(self, "Starting container...")
117
117
  end
118
118
 
119
119
  container = self.create_container
@@ -127,13 +127,14 @@ module Async
127
127
  end
128
128
 
129
129
  # Wait for all child processes to enter the ready state.
130
- Console.debug(self, "Waiting for startup...")
130
+ Console.info(self, "Waiting for startup...")
131
131
  container.wait_until_ready
132
- Console.debug(self, "Finished startup.")
132
+ Console.info(self, "Finished startup.")
133
133
 
134
134
  if container.failed?
135
135
  @notify&.error!("Container failed to start!")
136
136
 
137
+ Console.info(self, "Stopping failed container...")
137
138
  container.stop(false)
138
139
 
139
140
  raise SetupError, container
@@ -145,7 +146,7 @@ module Async
145
146
  container = nil
146
147
 
147
148
  if old_container
148
- Console.debug(self, "Stopping old container...")
149
+ Console.info(self, "Stopping old container...")
149
150
  old_container&.stop(@graceful_stop)
150
151
  end
151
152
 
@@ -168,11 +169,9 @@ module Async
168
169
  end
169
170
 
170
171
  # Wait for all child processes to enter the ready state.
171
- Console.debug(self, "Waiting for startup...")
172
-
172
+ Console.info(self, "Waiting for startup...")
173
173
  @container.wait_until_ready
174
-
175
- Console.debug(self, "Finished startup.")
174
+ Console.info(self, "Finished startup.")
176
175
 
177
176
  if @container.failed?
178
177
  @notify.error!("Container failed to reload!")
@@ -139,12 +139,18 @@ module Async
139
139
  # Stop the children instances.
140
140
  # @parameter timeout [Boolean | Numeric] Whether to stop gracefully, or a specific timeout.
141
141
  def stop(timeout = true)
142
+ Console.info(self, "Stopping container...", timeout: timeout, caller: caller_locations)
142
143
  @running = false
143
144
  @group.stop(timeout)
144
145
 
145
146
  if @group.running?
146
- Console.warn(self) {"Group is still running after stopping it!"}
147
+ Console.warn(self, "Group is still running after stopping it!")
148
+ else
149
+ Console.info(self, "Group has stopped.")
147
150
  end
151
+ rescue => error
152
+ Console.error(self, "Error while stopping container!", exception: error)
153
+ raise
148
154
  ensure
149
155
  @running = true
150
156
  end
@@ -165,7 +171,7 @@ module Async
165
171
  name ||= UNNAMED
166
172
 
167
173
  if mark?(key)
168
- Console.debug(self) {"Reusing existing child for #{key}: #{name}"}
174
+ Console.debug(self, "Reusing existing child.", child: {key: key, name: name})
169
175
  return false
170
176
  end
171
177
 
@@ -199,10 +205,10 @@ module Async
199
205
  end
200
206
 
201
207
  if status.success?
202
- Console.debug(self) {"#{child} exited with #{status}"}
208
+ Console.info(self, "Child exited successfully.", status: status, running: @running)
203
209
  else
204
210
  @statistics.failure!
205
- Console.error(self, status: status)
211
+ Console.error(self, "Child exited with error!", status: status, running: @running)
206
212
  end
207
213
 
208
214
  if restart
@@ -211,6 +217,11 @@ module Async
211
217
  break
212
218
  end
213
219
  end
220
+ rescue => error
221
+ Console.error(self, "Failure during child process management!", exception: error, running: @running)
222
+ raise
223
+ ensure
224
+ Console.info(self, "Child process management loop exited.", running: @running)
214
225
  end.resume
215
226
 
216
227
  return true
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.27.1"
8
+ VERSION = "0.27.2"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -26,6 +26,10 @@ Please see the [project documentation](https://socketry.github.io/async-containe
26
26
 
27
27
  Please see the [project releases](https://socketry.github.io/async-container/releases/index) for all releases.
28
28
 
29
+ ### v0.27.2
30
+
31
+ - More logging, especially around failure cases.
32
+
29
33
  ### v0.27.1
30
34
 
31
35
  - Log caller and timeout when waiting on a child instance to exit, if it blocks.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.27.2
4
+
5
+ - More logging, especially around failure cases.
6
+
3
7
  ## v0.27.1
4
8
 
5
9
  - Log caller and timeout when waiting on a child instance to exit, if it blocks.
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.27.1
4
+ version: 0.27.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubygems_version: 3.6.9
108
+ rubygems_version: 3.7.2
109
109
  specification_version: 4
110
110
  summary: Abstract container-based parallelism using threads and processes where appropriate.
111
111
  test_files: []
metadata.gz.sig CHANGED
Binary file