-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add resque scheduler for discussion update emails
- Loading branch information
Showing
6 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module SessionDiscussionUpdate | ||
@queue = :discussion_messages_mails | ||
|
||
def self.perform | ||
DiscussionMessagesWorker.perform | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
session_discussion_update_midnight: | ||
cron: "* * * * * Asia/Kolkata" | ||
class: SessionDiscussionUpdate | ||
queue: discussion_messages_mails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,40 @@ | ||
require 'resque/tasks' | ||
task 'resque:setup' => :environment | ||
task 'resque:setup' => :environment | ||
|
||
require 'resque-scheduler' | ||
require 'resque/scheduler/tasks' | ||
|
||
|
||
namespace :resque do | ||
task :setup do | ||
require 'resque' | ||
|
||
# you probably already have this somewhere | ||
Resque.redis = 'localhost:6379' | ||
end | ||
|
||
task :setup_schedule => :setup do | ||
require 'resque-scheduler' | ||
|
||
# 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 | ||
|
||
# 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('config/resque_schedule.yml') | ||
|
||
# If your schedule already has +queue+ set for each job, you don't | ||
# need to require your jobs. This can be an advantage since it's | ||
# less code that resque-scheduler needs to know about. But in a small | ||
# project, it's usually easier to just include you job classes here. | ||
# So, something like this: | ||
# require 'jobs' | ||
end | ||
|
||
task :scheduler => :setup_schedule | ||
end |