mirror of
https://github.com/endofunky/sidetiq.git
synced 2022-11-09 13:53:30 -05:00
parent
d460e6b991
commit
3ad47c4c89
3 changed files with 12 additions and 3 deletions
|
@ -9,10 +9,12 @@ module Sidetiq
|
|||
|
||||
# Public: Start time offset from epoch used for calculating run
|
||||
# times in the Sidetiq schedules.
|
||||
START_TIME = Sidetiq.config.utc ? Time.utc(2010, 1, 1) : Time.local(2010, 1, 1)
|
||||
def self.start_time
|
||||
Sidetiq.config.utc ? Time.utc(2010, 1, 1) : Time.local(2010, 1, 1)
|
||||
end
|
||||
|
||||
def initialize # :nodoc:
|
||||
@schedule = IceCube::Schedule.new(START_TIME)
|
||||
@schedule = IceCube::Schedule.new(self.class.start_time)
|
||||
end
|
||||
|
||||
def method_missing(meth, *args, &block) # :nodoc:
|
||||
|
|
|
@ -19,7 +19,7 @@ class TestClock < Sidetiq::TestCase
|
|||
def test_backfilling
|
||||
BackfillWorker.jobs.clear
|
||||
Sidetiq.stubs(:workers).returns([BackfillWorker])
|
||||
start = Sidetiq::Schedule::START_TIME
|
||||
start = Sidetiq::Schedule.start_time
|
||||
|
||||
BackfillWorker.stubs(:last_scheduled_occurrence).returns(start.to_f)
|
||||
clock.stubs(:gettime).returns(start)
|
||||
|
|
|
@ -34,5 +34,12 @@ class TestSchedule < Sidetiq::TestCase
|
|||
sched.set_options(backfill: false)
|
||||
refute sched.backfill?
|
||||
end
|
||||
|
||||
def test_use_utc
|
||||
Sidetiq.config.utc = true
|
||||
assert_equal(Time.utc(2010, 01, 01), Sidetiq::Schedule.new.start_time)
|
||||
ensure
|
||||
Sidetiq.config.utc = false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue