Class: NewsletterJob

Inherits:
Object
  • Object
show all
Defined in:
lib/newsletter_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/newsletter_job.rb', line 3

def perform
  Rails.logger.info "Sending Newsletters at #{Time.now}"
  command=<<-end_command
    ruby script/runner QueuedMail.send_email
  end_command
  command.gsub!(/\s+/, " ")
  if system(command)
    Delayed::Worker.logger.info "#{Time.now} : Newsletter sending success#{ $?.exitstatus == 0 ? '' : ', but exit status equal to '+exitstatus.to_s }"
  else
    Delayed::Worker.logger.info "#{Time.now} : Newsletter sending failed"
  end
end