SigHelper: Handle all errors, lower time between retries
All checks were successful
Invidious CI / build (push) Successful in 9m1s
All checks were successful
Invidious CI / build (push) Successful in 9m1s
This commit is contained in:
parent
2db9396dea
commit
34a11fe1bb
1 changed files with 12 additions and 5 deletions
|
@ -192,16 +192,18 @@ module Invidious::SigHelper
|
||||||
loop do
|
loop do
|
||||||
begin
|
begin
|
||||||
receive_data
|
receive_data
|
||||||
rescue ex : IO::EOFError
|
# Handle all errors
|
||||||
LOGGER.info("Connection to helper died, trying to reconnect...")
|
rescue ex
|
||||||
|
LOGGER.info("Connection to helper died with '#{ex.message}' trying to reconnect...")
|
||||||
# We close the socket because for some reason is not closed.
|
# We close the socket because for some reason is not closed.
|
||||||
@conn.close
|
@conn.close
|
||||||
loop do
|
loop do
|
||||||
begin
|
begin
|
||||||
@conn = Connection.new(@uri_or_path)
|
@conn = Connection.new(@uri_or_path)
|
||||||
rescue
|
LOGGER.info("Reconnected to SigHelper!")
|
||||||
LOGGER.debug("Reconnection to helper unsuccessful, retrying.")
|
rescue ex
|
||||||
sleep 1
|
LOGGER.debug("Reconnection to helper unsuccessful with error '#{ex.message}' retrying")
|
||||||
|
sleep 0.5
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
break if !@conn.closed?
|
break if !@conn.closed?
|
||||||
|
@ -323,6 +325,11 @@ module Invidious::SigHelper
|
||||||
return @socket.closed?
|
return @socket.closed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remote_address : Socket::IPAddress
|
||||||
|
|
||||||
|
return @socket.remote_address
|
||||||
|
end
|
||||||
|
|
||||||
def close : Nil
|
def close : Nil
|
||||||
@socket.close if !@socket.closed?
|
@socket.close if !@socket.closed?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue