Created
April 17, 2012 21:03
-
-
Save JonCrawford/2409038 to your computer and use it in GitHub Desktop.
Moving from delayed_job to resque
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.send_later :update_associations | |
Resque.enqueue UpdateAssociations, self.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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