No timeout on network errors
cluesque opened this issue · comments
Bill Kirtley commented
When using the mailgun gem delivering via https, sometimes (presumably in the face of network errors) the delivery never completes.
In our case, using sidekiq, this leads to depletion of our sidekiq workers (as well as the email that fails to deliver.)
Better would be to have some reasonable timeout and raise an exception.
I put up a simple rails project that demonstrates the problem.
It's got a sinatra server that acts as a slow fake mailgun API.
In one shell, run the fake mailgun server:
FAKE_MAILGUN_DELAY=90 ./bin/fake_mailgun.rb -p 8025
In another, rails console:
$ rails c
irb(main):001:0> SimpleMailer.hello_email('foo@example.net', 'hello there').deliver_now
That mail send will not return until the delay elapses.