Skip to content
Permalink
Browse files

changed settings for delayed job to test in prod

  • Loading branch information...
unknown unknown
unknown authored and unknown committed Jul 26, 2010
1 parent 7357895 commit a88eceac7c9427fb4f600e8c1569d526aae40b13
Showing with 6 additions and 4 deletions.
  1. +4 −2 lib/activity_tracking_notification.rb
  2. +2 −1 lib/tasks/initialize_jobs.rake
  3. +0 −1 script/delayed_job
@@ -6,7 +6,8 @@ def initialize

def perform
week_day = Time.now.wday
User.all(:conditions => ["(id % 7) = ?", week_day]).each do |user|
#User.all(:conditions => ["(id % 7) = ?", week_day]).each do |user|
User.all.each do |user|
next if !user.email_notification?
events = user.find_tracked_events(7.days.ago)
next if events.blank? #if there are no events to send per email, then get the hell out
@@ -30,6 +31,7 @@ def perform

user.deliver_activity_tracking_email!(question_events, tags, events - question_events)
end
Delayed::Job.enqueue ActivityTrackingNotification.new, 0, Time.now.tomorrow.midnight
#Delayed::Job.enqueue ActivityTrackingNotification.new, 0, Time.now.tomorrow.midnight
Delayed::Job.enqueue ActivityTrackingNotification.new, 0, 20.min.from_now
end
end
@@ -3,6 +3,7 @@ namespace :jobs do
task :initialize => :environment do
# Deletes old delayed Jobs and starts a new one for the activity tracking email sending
Delayed::Job.destroy_all
Delayed::Job.enqueue ActivityTrackingNotification.new, 0, Time.now.tomorrow.midnight
#Delayed::Job.enqueue ActivityTrackingNotification.new, 0, Time.now.tomorrow.midnight
Delayed::Job.enqueue ActivityTrackingNotification.new, 0, 20.min.from_now
end
end
@@ -3,4 +3,3 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize
Delayed::Job.enqueue ActivityTrackingNotification.new, 0, Time.now.tomorrow.midnight

0 comments on commit a88ecea

Please sign in to comment.
You can’t perform that action at this time.