Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
rake tasks refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
lazureykis committed May 4, 2012
1 parent 924cd1c commit 5227400
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/rabbit_jobs/tasks.rb
Expand Up @@ -14,10 +14,8 @@ def initialize_rj_daemon(daemon)
daemon
end

task :setup

desc "Start a Rabbit Jobs worker"
task :worker => [ :preload, :setup ] do
task :worker => :environment do
require 'rabbit_jobs'

queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split(',')
Expand All @@ -27,14 +25,14 @@ def initialize_rj_daemon(daemon)
end

desc "Start a Rabbit Jobs scheduler"
task :scheduler => [ :preload, :setup ] do
task :scheduler => :environment do
scheduler = initialize_rj_daemon(RabbitJobs::Scheduler.new)

scheduler.work
end

# Preload app files if this is Rails
task :preload => :setup do
task :environment do
if defined?(Rails) && Rails.respond_to?(:application)
# Rails 3
# Rails.application.eager_load!
Expand Down

0 comments on commit 5227400

Please sign in to comment.