starting Resque
This commit is contained in:
parent
f949523bbb
commit
f3b58ea36d
5
Gemfile
5
Gemfile
|
@ -19,9 +19,8 @@ gem "mongo_session_store-rails3"
|
|||
gem 'nokogiri'
|
||||
gem 'radius'
|
||||
gem 'rake'
|
||||
gem 'resque' # background jobs
|
||||
gem 'resque-scheduler' # job scheduling
|
||||
gem 'resque-restriction'
|
||||
gem 'resque-scheduler', :require => 'resque_scheduler'
|
||||
gem 'resque', :require => "resque/server"
|
||||
gem 'ruby-debug19'
|
||||
gem 'rubyzip'
|
||||
gem 'sinatra'
|
||||
|
|
|
@ -161,8 +161,6 @@ GEM
|
|||
redis-namespace (~> 1.0.2)
|
||||
sinatra (>= 0.9.2)
|
||||
vegas (~> 0.1.2)
|
||||
resque-restriction (0.3.0)
|
||||
resque (>= 1.7.0)
|
||||
resque-scheduler (1.9.9)
|
||||
redis (>= 2.0.1)
|
||||
resque (>= 1.8.0)
|
||||
|
@ -278,7 +276,10 @@ DEPENDENCIES
|
|||
rails (>= 3.1.0, < 3.2.0)
|
||||
rake
|
||||
resque
|
||||
<<<<<<< HEAD
|
||||
resque-restriction
|
||||
=======
|
||||
>>>>>>> starting Resque
|
||||
resque-scheduler
|
||||
rspec (~> 2.0)
|
||||
rspec-rails (~> 2.0)
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
# require 'open-uri'
|
||||
# require 'nokogiri'
|
||||
class FetchTime < Resque::Plugins::RestrictionJob
|
||||
restrict :per_300 => 10
|
||||
|
||||
@queue = :low
|
||||
require 'open-uri'
|
||||
require 'nokogiri'
|
||||
module FetchTime
|
||||
@queue = :fetch_time
|
||||
|
||||
def self.perform()
|
||||
# sleep 10
|
||||
sleep 10
|
||||
doc = Nokogiri::HTML(open('http://www.timeanddate.com/worldclock/city.html?n=241'))
|
||||
CronMail.time_check(doc.at('#ct').children.first.text).deliver
|
||||
puts "Mail Sent"
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
require 'resque_scheduler'
|
||||
# require 'resque_scheduler/server'
|
||||
# require 'yaml'
|
||||
require 'resque_scheduler'require 'resque_scheduler/server'
|
||||
require 'yaml'
|
||||
|
||||
Resque.redis = 'localhost:6379'
|
||||
#Resque.redis.namespace = "resque:SchedulerExample"
|
||||
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
|
||||
rails_env = ENV['RAILS_ENV'] || 'development'
|
||||
|
||||
# If you want to be able to dynamically change the schedule,
|
||||
# uncomment this line. A dynamic schedule can be updated via the
|
||||
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
|
||||
# When dynamic is set to true, the scheduler process looks for
|
||||
# schedule changes and applies them on the fly.
|
||||
# Note: This feature is only available in >=2.0.0.
|
||||
#Resque::Scheduler.dynamic = true
|
||||
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
|
||||
Resque.redis = resque_config[rails_env]
|
||||
|
||||
Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml")
|
||||
Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file }
|
||||
|
||||
# The schedule doesn't need to be stored in a YAML, it just needs to
|
||||
# be a hash. YAML is usually the easiest.
|
||||
Resque.schedule = YAML.load_file(Rails.root.join('config', 'resque_schedule.yml'))
|
||||
# current_path = Rails.root.to_s.gsub(/\s/,'\ ')
|
||||
# queues = [:test]
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
development: localhost:6379
|
||||
production: localhost:6379
|
|
@ -1,17 +1,6 @@
|
|||
do_mail_matt:
|
||||
every: 10s
|
||||
time_to_talk_a_rest:
|
||||
cron: "*/5 * * * *"
|
||||
class: FetchTime
|
||||
args:
|
||||
description: Runs the perform method in FetchTime
|
||||
|
||||
nccu_daily_ldap_sync:
|
||||
cron: 30 * * * * *
|
||||
class: SyncDb
|
||||
args:
|
||||
description: Runs the perform method in SnycDB
|
||||
|
||||
nccu_claender_sync:
|
||||
every: 1m
|
||||
class: NccuCalendar
|
||||
args:
|
||||
description: Runs the perform method in NccuCalendar
|
||||
queue: daemons
|
||||
rails_env: development
|
||||
description: Send Email for Remind Time
|
||||
|
|
Reference in New Issue