mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 01:35:30 +08:00
FIX: don't re-scheduler correctly scheduled daily tasks
This commit is contained in:
parent
25097deb39
commit
66ef7976ea
@ -28,6 +28,9 @@ module Scheduler
|
|||||||
@next_run = @prev_run = @prev_result = @prev_duration = @current_owner = nil
|
@next_run = @prev_run = @prev_result = @prev_duration = @current_owner = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# this means the schedule is going to fire, it is setup correctly
|
||||||
|
# invalid schedules are fixed by running "schedule!"
|
||||||
|
# this happens automatically after if fire by the manager
|
||||||
def valid?
|
def valid?
|
||||||
return false unless @next_run
|
return false unless @next_run
|
||||||
(!@prev_run && @next_run < Time.now.to_i + 5.minutes) || valid_every? || valid_daily?
|
(!@prev_run && @next_run < Time.now.to_i + 5.minutes) || valid_every? || valid_daily?
|
||||||
@ -42,8 +45,9 @@ module Scheduler
|
|||||||
|
|
||||||
def valid_daily?
|
def valid_daily?
|
||||||
return false unless @klass.daily
|
return false unless @klass.daily
|
||||||
|
return true if !@prev_run && @next_run && @next_run <= (Time.zone.now + 1.day).to_i
|
||||||
!!@prev_run &&
|
!!@prev_run &&
|
||||||
@prev_run <= Time.now.to_i &&
|
@prev_run <= Time.zone.now.to_i &&
|
||||||
@next_run < @prev_run + 1.day
|
@next_run < @prev_run + 1.day
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user