LoginSignup
1
0

More than 3 years have passed since last update.

再試行待ちの DelayedJob を手動で再実行する

Last updated at Posted at 2019-06-28

背景

  • DelayedJobmax_attempts を多めに設定している (デフォルトの25回など)
  • 次回のジョブの実行まで長い時間がかかりそうで手動で再実行したい

やったこと

  • delayed_jobs テーブルの attempts を 0 に変更して、即時実行した
Delayed::Job.all.each do |dj|
  dj.run_at = Time.now;
  dj.attempts = 0;
  dj.save!
end

注意点

  • 上のコードではそのとき実行されているジョブのデータを変更してしまうことがある
    • locked_at, last_error などのカラムを使って対象としたいジョブのみに絞って実行すればよい
1
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
1
0