Skip to content

Commit 86421ce

Browse files
authored
Move error handling to ensure loop continues after child process management (#46)
1 parent 2826b6e commit 86421ce

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/async/container/generic.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,13 @@ def spawn(name: nil, restart: false, key: nil, health_check_timeout: nil, &block
203203
age_clock&.reset!
204204
end
205205
end
206+
rescue => error
207+
Console.error(self, "Error during child process management!", exception: error, running: @running)
206208
ensure
207209
delete(key, child)
208210
end
209211

210-
if status.success?
212+
if status&.success?
211213
Console.info(self, "Child exited successfully.", status: status, running: @running)
212214
else
213215
@statistics.failure!
@@ -220,9 +222,6 @@ def spawn(name: nil, restart: false, key: nil, health_check_timeout: nil, &block
220222
break
221223
end
222224
end
223-
rescue => error
224-
Console.error(self, "Failure during child process management!", exception: error, running: @running)
225-
raise
226225
ensure
227226
Console.info(self, "Child process management loop exited.", running: @running)
228227
end.resume

0 commit comments

Comments
 (0)