DEV: Require scheduled job in development to avoid loading file twice.
This removes the need to memoize constant in order to avoid the "warning: already initialized constant".
This commit is contained in:
parent
09a89cff1a
commit
069a109cbb
|
@ -4,7 +4,7 @@ module Jobs
|
|||
class GrantNewUserOfTheMonthBadges < ::Jobs::Scheduled
|
||||
every 1.day
|
||||
|
||||
MAX_AWARDED ||= 2
|
||||
MAX_AWARDED = 2
|
||||
|
||||
def execute(args)
|
||||
badge = Badge.find(Badge::NewUserOfTheMonth)
|
||||
|
|
|
@ -4,7 +4,7 @@ module Jobs
|
|||
class OldKeysReminder < ::Jobs::Scheduled
|
||||
every 1.month
|
||||
|
||||
OLD_CREDENTIALS_PERIOD ||= 2.years
|
||||
OLD_CREDENTIALS_PERIOD = 2.years
|
||||
|
||||
def execute(_args)
|
||||
return if SiteSetting.send_old_credential_reminder_days.to_i == 0
|
||||
|
|
|
@ -23,7 +23,7 @@ module Jobs
|
|||
Email::Processor.process!(popmail.pop)
|
||||
end
|
||||
|
||||
POLL_MAILBOX_TIMEOUT_ERROR_KEY ||= "poll_mailbox_timeout_error_key"
|
||||
POLL_MAILBOX_TIMEOUT_ERROR_KEY = "poll_mailbox_timeout_error_key"
|
||||
|
||||
def poll_pop3
|
||||
pop3 = Net::POP3.new(SiteSetting.pop3_polling_host, SiteSetting.pop3_polling_port)
|
||||
|
@ -62,7 +62,7 @@ module Jobs
|
|||
Discourse.handle_job_exception(e, error_context(@args, "Signing in to poll incoming emails."))
|
||||
end
|
||||
|
||||
POLL_MAILBOX_ERRORS_KEY ||= "poll_mailbox_errors"
|
||||
POLL_MAILBOX_ERRORS_KEY = "poll_mailbox_errors"
|
||||
|
||||
def self.errors_in_past_24_hours
|
||||
Discourse.redis.zremrangebyscore(POLL_MAILBOX_ERRORS_KEY, 0, 24.hours.ago.to_i)
|
||||
|
|
|
@ -5,7 +5,7 @@ module Jobs
|
|||
class ReindexSearch < ::Jobs::Scheduled
|
||||
every 2.hours
|
||||
|
||||
CLEANUP_GRACE_PERIOD ||= 1.day.ago
|
||||
CLEANUP_GRACE_PERIOD = 1.day.ago
|
||||
|
||||
def execute(args)
|
||||
@verbose = true if args && Hash === args && args[:verbose]
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
# Ensure that scheduled jobs are loaded before mini_scheduler is configured.
|
||||
if Rails.env == "development" && Sidekiq.server?
|
||||
require "jobs/base"
|
||||
|
||||
Dir.glob("#{Rails.root}/app/jobs/scheduled/*.rb") do |f|
|
||||
load(f)
|
||||
require(f)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue