DEPRECATION WARNING cleanup! is deprecated and will be removed from Rails 5.1
Rails5でdelayed_jobを起動したら、以下のようなWARNINGが出力されました。
DEPRECATION WARNING: cleanup! is deprecated and will be removed from Rails 5.1 (use Rails.application.reloader.reload! instead of cleanup + prepare) (called from <top (required)> at bin/delayed_job:5
気持ちが悪いのGoogle大先生に聞いてみたところ下記がヒットしました。
請負になりますが、
initializers配下にdj_rails5_patches.rbを下記のように作りました。
config/initializers/dj_rails5_patches.rb
module DelayedWorkerPatches def reload! return unless self.class.reload_app? if defined?(ActiveSupport::Reloader) Rails.application.reloader.reload! else ActionDispatch::Reloader.cleanup! ActionDispatch::Reloader.prepare! end end end module Delayed class Worker prepend DelayedWorkerPatches end end
これで、ワーニングは出力されないようになりました。 ありがうございます。
関連記事
- 作者: 掌田津耶乃
- 出版社/メーカー: 秀和システム
- 発売日: 2016/12/17
- メディア: 単行本
- この商品を含むブログを見る