Skip to content

Instantly share code, notes, and snippets.

@JonCrawford
Created April 17, 2012 21:03
Show Gist options
  • Save JonCrawford/2409038 to your computer and use it in GitHub Desktop.
Save JonCrawford/2409038 to your computer and use it in GitHub Desktop.
Moving from delayed_job to resque
self.send_later :update_associations
Resque.enqueue UpdateAssociations, self.id
class UpdateAssociations
extend Resque::Plugins::ExponentialBackoff
extend Resque::Plugins::Lock
@queue = :low
def self.perform id
# If you use Store.find(id), it will raise a RecordNotFound exception, if store isn't found
store = Store.find_by_id(id)
return unless store
store.update_association_deltas
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment