31 lines
641 B
Ruby
31 lines
641 B
Ruby
require 'json'
|
|
require 'resque'
|
|
require 'resque-retry'
|
|
require 'net/http'
|
|
require 'digest/md5'
|
|
|
|
module JamRuby
|
|
|
|
# periodically scheduled to find jobs that need retrying
|
|
class TallyAffiliates
|
|
extend Resque::Plugins::JamLonelyJob
|
|
|
|
@queue = :tally_affiliates
|
|
|
|
@@log = Logging.logger[TallyAffiliates]
|
|
|
|
def self.lock_timeout
|
|
# this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
|
|
120
|
|
end
|
|
|
|
def self.perform
|
|
@@log.debug("waking up")
|
|
|
|
AffiliatePartner.tally_up(Date.today)
|
|
|
|
@@log.debug("done")
|
|
end
|
|
end
|
|
|
|
end |