Created
December 4, 2017 16:33
-
-
Save carlosagp/d951adedc4d1b776fb92500b6f5a98a8 to your computer and use it in GitHub Desktop.
Get Last Resque Job and perform
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
def get_last_job_and_perform(queue) | |
raw_job = Resque.redis.lrange("queue:#{queue}", 0, -1).last | |
job = Resque.decode(raw_job) | |
klass = Resque::Job.constantize(decoded_job['class']) | |
klass.perform(*decoded_job['args']) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment