Hi Jeremy,

I am having some trouble figuring out how to deal with this issue with 
resque/redis and heroku. Just recently run into what seems to be this issue 
after a bit of testing on a live heroku dyno fails with similar error from 
the second job onwards ( on restart it seems to manage one job ). 

On Heroku they give some documentation on how to properly init redis for 
resque with active record 
- https://devcenter.heroku.com/articles/forked-pg-connections

Unfortunately i cant seem to work out the equivalent code for sequel.

Sorry to bring up old issues,
Cheers

M

On Sunday, 2 December 2012 22:01:38 UTC, Jeremy Evans wrote:
>
> On Sunday, December 2, 2012 1:46:48 PM UTC-8, Daniel Tsai wrote:
>
>> I really appreciate your quick reply and I have been a big fan of Sequel. 
>> I just want to make sure I understand correctly that I only need to call 
>> DB.disconnect in before_fork block and do not do anything in after_fork 
>> block. Will DB get the connection automatically in this case?
>>
>> before_fork do |server, worker|
>>   # Disconnect all database connection from Sequel
>>   DB.disconnect
>>   sleep 1
>> end
>>
>> after_fork do |server, worker|
>>   # Do nothing here and DB will connect automatically
>> end
>>
>
> Correct.  The only part of Sequel that cannot be shared in a multiprocess 
> application is the underlying database socket connections.  DB.disconnect 
> clears the connections from the Database object's connection pool, and 
> doing that before forking ensures that each forked child will have its own 
> connections that are not shared (connections will be reestablished on an 
> as-needed basis in each child).
>
> 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 [email protected].
To post to this group, send email to [email protected].
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