Skip to content

Instantly share code, notes, and snippets.

@jrom
Created March 15, 2012 15:55
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 jrom/2044930 to your computer and use it in GitHub Desktop.
Save jrom/2044930 to your computer and use it in GitHub Desktop.
Remove resque jobs if match a condition
def remove_failed_jobs_if(&block)
i = 0
while i < Resque::Failure.count
job = Resque::Failure.all(i)
if yield job
Resque::Failure.remove(i)
else
i += 1
end
end
end
# Example usage
remove_failed_jobs_if { |job| job['queue'] == 'cache_warmer' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment