On Thursday, October 13, 2016 at 7:28:04 AM UTC-7, Nicolò Benigni wrote:
>
> Hi, 
> I am using resque in my rails application but I am having this problem. 
> After some hour of inactivity, obviously mysql goes in timeout and resque 
> workers lost connection. 
> So, when a new job is enqueued it raises:
>
> Exception
> Sequel::DatabaseDisconnectError
> Error
> Mysql2::Error: MySQL server has gone away
>
> I don't really know how to handle this.. on the resque docs, they say to 
> use ActiveRecord::Base.verify_active_connections! to avoid this, but how 
> can I solve it with Sequel? I read the docs and it says that Sequel does 
> not leaks connections, but in this special case something like this happens.
>
> How can I handle this? I am wondering if there is a way to avoid this, or 
> to reconnect when this error happens!
>

The best way to fix it is to fix your network so that your connections 
don't get disconnected.  However, if you can't do that, you can try the 
connection_validator extension, which will remove connections from the pool 
if they are not longer valid.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to