Search code examples
ruby-on-railsredisresque

Starting resque workers while started development server


I want to start my workers when I start my development server to test the a new cron job I have in my resque scheduler, so I run this command when starting dev server-

QUEUE=* rake environment resque:work rails s

it has worked for me before and if I'm reading their documentation correctly should still work.

But I'm getting the following error after I interrupt it after it gets hung up-

^Crake aborted!
Don't know how to build task 'rails'

here is what I get after keyboard interrupt and running it with --trace

** Invoke environment (first_time)
** Execute environment
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment
** Execute resque:setup
** Execute resque:preload
** Invoke resque:setup
** Execute resque:work
^Crake aborted!
Don't know how to build task 'rails'

I don't understand why I would be getting the error and additionally why it previously loaded and worked but not anymore. What am I missing here?


Solution

  • Are you sure that you manage to run this command sometime back successfully

    QUEUE=* rake environment resque:work rails s

    because the way I know rails s is a list of rails command not a rake task

    you can run consecutive rake separating spaces like

    QUEUE=* rake environment rake1 rake2 rake3

    but you cant run a rake and rails command they way you mention above

    what I see from your trace above that rake(resque rake) is running now instead of passing a second rake you specified a rails command to start the server rake is considering that as rake task (which is not true)

    I believe you are looking for this

    QUEUE=* rake environment resque:work && rails s

    But I dont believe that what you have mention would ever work please let me know if something conflict over here

    Hope It make sense