Closed gnumarcelo closed 1 year ago
Hi @gnumarcelo,
The error callback is implemented here in net-http2. It looks like exceptions are not re-raised, so I think that exceptions raised in the connection will not trigger an automatic retry:
def callback_or_raise(exception)
if callback_events.keys.include?(:error)
emit(:error, exception)
else
raise exception
end
end
You could do something like this to surface the exception for your job, if you also want use an error callback:
APNOTIC_POOL = Apnotic::ConnectionPool.new do |connection|
connection.on(:error) { |exception|
puts "Exception has been raised: #{exception}"
raise exception
}
end
Thanks!
Hi, I just have one doubt about the example provided at the Usage with Sidekiq / Resque: In the example, I can see the error callback being specified:
connection.on(:error) { |exception| puts "Exception has been raised: #{exception}" }
But under the Thread-Safety section, it states: "If you're using Apnotic with a job manager you should be fine by not specifying this callback."
My question is, if, using it with Sidekiq and I specify the error callback as in the example, it means that once an error happens it will not trigger Sidekiq retry mechanism, is it correct?
ps.: Thanks for making such a great library!!!