I have Que 0.7.3 in a Rails 4.1.1 application on MRI running Thin and using all default settings except for config.que.worker_count = 1 in my config/environments/development.rb. My ActiveRecord connection pool is set to 5 connections.
When I run rails s, on my last attempt, the app successfully started up 1 in 10 tries. For the other 9, I received the following output:
/Users/jamieenglish/projects/ee2e/.bundle/gems/activerecord-4.1.1/lib/active_record/connection_handling.rb:109:in `connection_pool': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/adapters/active_record.rb:30:in `checkout_activerecord_adapter'
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/adapters/active_record.rb:5:in `checkout'
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/job.rb:82:in `work'
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/worker.rb:76:in `block in work_loop'
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/worker.rb:73:in `loop'
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/worker.rb:73:in `work_loop'
from /Users/jamieenglish/projects/ee2e/.bundle/gems/que-0.7.3/lib/que/worker.rb:17:in `block in initialize'
This seems like a race condition, as if I add sleep 2 to the top of Que::Worker#work_loop all is fine.
Happy to provide a fix if pointed in the right direction.
I have Que 0.7.3 in a Rails 4.1.1 application on MRI running Thin and using all default settings except for
config.que.worker_count = 1in myconfig/environments/development.rb. My ActiveRecord connection pool is set to 5 connections.When I run
rails s, on my last attempt, the app successfully started up 1 in 10 tries. For the other 9, I received the following output:This seems like a race condition, as if I add
sleep 2to the top ofQue::Worker#work_loopall is fine.Happy to provide a fix if pointed in the right direction.