Skip to content

Instantly share code, notes, and snippets.

@carlosagp
Created December 4, 2017 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosagp/d951adedc4d1b776fb92500b6f5a98a8 to your computer and use it in GitHub Desktop.
Save carlosagp/d951adedc4d1b776fb92500b6f5a98a8 to your computer and use it in GitHub Desktop.
Get Last Resque Job and perform
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