Files
danbooru/config/initializers/delayed_jobs.rb
evazion 1bb1b147ea Fix autoloading deprecation warning in delayed job initializer.
DEPRECATION WARNING: Initialization autoloaded the constants
    Danbooru::Paginator and Danbooru::Paginator::ActiveRecordExtension.

    Being able to do this is deprecated. Autoloading during
    initialization is going to be an error condition in future versions
    of Rails.

    Reloading does not reboot the application, and therefore code
    executed during initialization does not run again. So, if you reload
    Danbooru::Paginator, for example, the expected changes won't be
    reflected in that stale Module object.

    `config.autoloader` is set to `classic`. These autoloaded constants
    would have been unloaded if `config.autoloader` had been set to
    `:zeitwerk`.

    Please, check the "Autoloading and Reloading Constants" guide for
    solutions.
2019-09-01 13:10:37 -05:00

17 lines
547 B
Ruby

require 'delayed/plugin'
require 'danbooru/paginator/active_record_extension'
class DelayedJobTimeoutPlugin < ::Delayed::Plugin
callbacks do |lifecycle|
lifecycle.before(:execute) do |job|
Delayed::Job.connection.execute "set statement_timeout = 0"
end
end
end
Delayed::Worker.logger = Logger.new(STDOUT, level: :debug)
Delayed::Worker.default_queue_name = "default"
Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.plugins << DelayedJobTimeoutPlugin
Delayed::Job.include(Danbooru::Paginator::ActiveRecordExtension)