Worker only starts with more than one job on queue? #29

fixr opened this Issue Oct 10, 2012 · 3 comments


None yet

3 participants


Testing an app on the Cedar stack, seems like the worker only starts after a second job is added to the queue, both setting the MIN/MAX/RATIO configs and not. Is this the expected behavior?

I'm using:

workless 1.1.0
delayed_job 3.x
ruby 1.9.2
rails 3.2.7

Also: local works fine.



Browsing the code, I think that maybe the issue was introduced here:


client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => 1) if self.workers == 0


client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => self.workers_needed) if self.workers < self.workers_needed

I might be wrong, but my guess is that self.workers_needed returns '0' the first time around becuase it's hooked before the insertion is made, so is still 0 at that point.


Looks like you've nailed it, @fixr!

@lostboy, I've checked my patch on Heroku, seems to be working as expected. Could you merge and release? Thanks!


@filiptepper , @fixr so it should be reverted to the original 'before' state? do you want to submit a pr so i don't bodge it?

@lostboy lostboy pushed a commit that closed this issue Oct 13, 2012
Filip Tepper spawn workers after_create
fixes #29
@lostboy lostboy closed this in 4343492 Oct 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment