I have the same problem and happened to google this thread. Is my modifed
unicorn config ok?
require 'sequel'
require 'redis'
require 'sidekiq'
worker_processes 4
preload_app true
timeout 90
before_fork do |server, worker|
# Disconnect all database connection from Sequel
DB.disconnect
sleep 1
end
after_fork do |server, worker|
# Reconnect database by Sequel
DB = Sequel.connect(ENV['DATABASE_URL'])
# Reconnect Redis
$redis = Redis.new(:url => ENV['REDIS_PROVIDER'])
# Reconnect Sidekiq Redis client
Sidekiq.configure_client do |config|
config.redis = { :url => ENV['REDIS_PROVIDER'], :size => 1 }
end
end
Thanks,
Daniel
On Sunday, October 21, 2012 6:22:30 AM UTC+8, Jeremy Evans wrote:
>
> On Saturday, October 20, 2012 11:07:59 AM UTC-7, David Ott wrote:
>>
>> Jeremy,
>>
>> Thanks for your comments. The retries were me grasping at straws. I
>> figured it wasn't helping.
>>
>> I think your assumption is correct. These services are using Passenger.
>> Where is the best place to disconnect? I have an init.rb file that sets the
>> connection and that gets required in the sinatra file. Can i call
>> disconnect at the end of that init file?
>>
>
> IIRC, Passenger, unlike Unicorn, lacks a before_fork hook, so
> disconnecting near the end of the application code loading is the best
> place.
>
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/Lf6A2bjIvJYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.