A platform for community discussion. Free, open, simple.
FEATURE: warn about sidekiq overload prior to migrating
Sam Saffrona2428bd86206
diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rakeindex 5791d472a7a..f32bf80211a 100644--- a/lib/tasks/uploads.rake+++ b/lib/tasks/uploads.rake@@ -246,6 +246,10 @@ def migration_successful?(db, should_raise = false)count = Post.where('baked_version <> ? OR baked_version IS NULL', Post::BAKED_VERSION).countif count > 0puts "#{count} posts still require rebaking and will be rebaked during regular job"+ if count > 100+ puts "To speed up migrations of posts we recommend you run 'rake posts:rebake_uncooked_posts'"+ end+ success = falseelseputs "No posts require rebaking"end@@ -260,6 +264,12 @@ task "uploads:s3_migration_status" => :environment dosuccess &&= migration_successful?(db)end+ queued_jobs = Sidekiq::Stats.new.queues.sum { |_ , x| x }+ if queued_jobs > 50+ puts "WARNING: There are #{queued_jobs} jobs queued! Wait till Sidekiq clears backlog prior to migrating site to a new host"+ exit 1+ end+exit 1 if !successputs "All sites appear to have uploads in order!"