0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Sidekiqが死んだままサービス運用をしてしまった際の復旧手順について

Last updated at Posted at 2021-07-20

1. 現状蓄えられているQueueを確認

> stats = Sidekiq::Stats.new
> stats.queues
 { "default" => 100, "mailers" => 400 }

keyはQueueの名前、valueはQueue内のJob数です。

2. すべてのJobを削除

stats.queues.keys.each do |queue_name|
  queue = Sidekiq::Queue.new(queue_name)
  queue.each do |job|
    # 特定のjobだけを消したい場合はなんかしらのガード文を書く
    # next unless job.klass == "SampleWorker"
    job.delete
  end
end

3. Queueが消えているかを確認

> stats.queues
 { "default" => 0, "mailers" => 0 }

4. 再起動

5. チームメンバーへ謝罪


参考
https://qiita.com/dany1468/items/20cf0dfc40d589993bda
https://www.it-swarm-ja.com/ja/ruby-on-rails/%E3%82%AD%E3%83%A5%E3%83%BC%E5%86%85%E3%81%AE%E5%86%85%E5%AE%B9%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%97%E3%80%81sidekiq%E3%81%A7%E3%82%AD%E3%83%A5%E3%83%BC%E3%82%92%E3%82%AF%E3%83%AA%E3%82%A2%E3%81%99%E3%82%8B%E3%82%B3%E3%83%B3%E3%82%BD%E3%83%BC%E3%83%AB%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F/1069431510/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?