intertubz

September 23, 2011 at 1:39pm
Home

rake tasks resque’d

i’m a big fan of resque and resque-scheduler. writing resque tasks is simple and painless, however sometimes i find the need to enqueue a rake task natively.

this quick little task will allow you to enqueue existing rake tasks through resque:

module Resque::Rake
  @queue = :rake
  def self.perform task
    Rake::Task[task].invoke
  end
end

you can now spin up dedicated, stateful rake task workers to consume your rake queue.

Notes

  1. cna-certification-a reblogged this from dallas
  2. dallas reblogged this from intertubz
  3. intertubz posted this