Skip to content

Instantly share code, notes, and snippets.

@blasterpal
Created July 11, 2012 16:26
Show Gist options
  • Save blasterpal/3091545 to your computer and use it in GitHub Desktop.
Save blasterpal/3091545 to your computer and use it in GitHub Desktop.
Resque snippits
Resque.redis.del 'queue:conversions'
Resque.redis.del 'queue:statistics'
#Clear all workers from Redis to ensure no worker creep
Resque.redis.smembers('workers').each{|w| Resque.redis.srem 'workers',w}
#Inspecting error types and histogram of counts:
failed_hash = (Resque.redis.lrange :failed, 1,473).collect{|ea| JSON.load ea};p nil
histogram = {}
failed_hash.each { |item| histogram[item["exception"]] = (histogram[item["exception"]] || 0) +1 };p nil
histogram
#kill specific working queue, rough command it might take out other forked processes, but it's meant as hammer attack
ps -ef | grep resque | egrep -E 'Forked|statistics' | cut -c8-15 | xargs kill -9
#resque process tree
ps axjf | egrep -e 'resque.*Forked|resque.*Waiting|resque.*Processing'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment