Skip to content

Commit 19d97d5

Browse files
authored
Rescue errors in Supervisor server. (#3)
1 parent 3e56a16 commit 19d97d5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/async/container/supervisor/server.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ def do_restart(call)
4646
# We are going to terminate the progress group, including *this* process, so finish the current RPC before that:
4747
call.finish
4848

49-
::Process.kill(signal, ::Process.ppid)
49+
begin
50+
::Process.kill(signal, ::Process.ppid)
51+
rescue => error
52+
Console.error(self, "Error while sending #{signal} to process!", signal: signal, exception: error)
53+
end
5054
end
5155

5256
def do_status(call)
5357
@monitors.each do |monitor|
5458
monitor.status(call)
59+
rescue => error
60+
Console.error(self, "Error while getting status!", monitor: monitor, exception: error)
5561
end
5662

5763
call.finish
@@ -80,6 +86,8 @@ def run(parent: Task.current)
8086
@endpoint.accept do |peer|
8187
connection = Connection.new(peer, 1)
8288
connection.run(self)
89+
rescue => error
90+
Console.error(self, "Error while accepting connection!", exception: error)
8391
ensure
8492
connection.close
8593
remove(connection)

0 commit comments

Comments
 (0)