Sha256: 7b22d1469676fc67244414129a9796450ceb03afde36c38d10f46b9301506930
Contents?: true
Size: 1.06 KB
Versions: 13
Compression:
Stored size: 1.06 KB
Contents
=begin rdoc Author:: Chris Hauboldt (mailto:biz@lnstar.com) Copyright:: 2009 Lone Star Internet Inc. Worker used to check for ready Mailings and process/send them. =end module MailManager class TestMessageJob < Struct.new(:repeats_every) def perform TestMessageJob.run end def self.run while(test_message=get_ready) do Rails.logger.info "Sending Test Message for '#{test_message.mailing.subject}' to #{test_message.email_address}" begin test_message.deliver test_message.change_status(:sent) rescue => e test_message.result = "Error: #{e.message} - #{e.backtrace.join("\n")}" test_message.change_status(:failed) end sleep MailManager.sleep_time_between_messages end end def self.get_ready MailManager::Lock.with_lock('mail_manager_test_message_ready') do |lock| test_message = TestMessage.ready.first return nil if test_message.nil? test_message.change_status('processing') return test_message end end end end
Version data entries
13 entries across 13 versions & 1 rubygems