Last active
April 8, 2018 02:14
-
-
Save joeyAghion/9274268 to your computer and use it in GitHub Desktop.
delayed jobs by queue and priority
This file contains hidden or 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
| # Number of queued jobs per queue and priority | |
| pp Delayed::Job.distinct(:queue).sort.map{|q| Delayed::Job.where(queue: q).distinct(:priority).sort.map{|p| [q, p, Delayed::Job.where(queue: q, priority: p).count] } }.sort; nil | |
| # First 20 jobs, in order that workers dequeue them | |
| pp Delayed::Job.where(:run_at.lte => Time.now.utc, failed_at: nil).any_of({locked_by: /worker/}, {locked_at: nil}, {locked_at: {'$lt' => (Time.now.utc - 14400)}}).any_in(queue: %w{any imgs}).desc(:locked_by).asc(:priority).asc(:run_at).limit(20).map{|j| [j.id, j.handler.inspect[0..250], j.locked_by, j.run_at, (Time.now.utc - j.locked_at if j.locked_at)] }; nil | |
| # Failing jobs by queue and error start | |
| pp Delayed::Job.where(:last_error.exists => true).group_by{|j| [j.queue, j.priority] }.map{|(q,p),js| [q,p,js.group_by{|j| j.last_error[0...60]}.map{|err,jobs| [err,jobs.size] }] }; nil | |
| # | |
| grouped = Delayed::Job.where(queue: 'any', priority: 3).group_by{|j| j.handler.match(/method_name: (.*)$/).try('[]', 1) || j.handler.inspect[0...50] }; pp grouped.map{|k,v| [k,v.size] }; nil | |
| [["\"--- !ruby/struct:DelayedJobSessionProxy::DelayedJ", 44447], | |
| [":update_partner_artists", 2033], | |
| [":notify_published", 44], | |
| [":onboard!", 347], | |
| [":update_artists!", 227], | |
| [":invalidate_sale!", 203], | |
| [":update_for!", 94], | |
| [":remove_from_partner_shows!", 29], | |
| [":welcome!", 52], | |
| [":update_coordinates!", 15], | |
| [":update_auction_artists", 3], | |
| [":update_artist_auction_lots_count", 135], | |
| [":invalidate_related_profiles", 46], | |
| [":copy_image_to_user_icon!", 5], | |
| [":update_partner_shows!", 20], | |
| [":set_default_image!", 8], | |
| [":destroy_reposts!", 1], | |
| [":remind!", 2], | |
| [":generate_and_queue_daily_digest!", 1], | |
| [":update_artworks_batch", 1667], | |
| [":send!", 23], | |
| [":destroy_follows!", 3], | |
| [":update_partner_artist", 3]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment