Skip to content

Instantly share code, notes, and snippets.

View devdatta's full-sized avatar

Devdatta Kane devdatta

View GitHub Profile
module Resque
##
# Resque StateMachine
#
# Is a Mash to be used in a resque queue. The create method will
# initiate the object and enqueue it.
#
# Can pass in a run_at attribute to delay the run.
# Can pass in a test_mode attribute to force test mode.
#
class GetEventResult
@queue = :events
def self.perform(event_id, attempt=0)
event = Event.find(event_id)
Rails.logger.info "Fetching results for event ##{event.id} (#{event.name})..."
begin
results = EventImporter.new(event.datetime.to_date).get_results(event)
rescue OpenURI::HTTPError