Safety check before using row values.
FossilOrigin-Name: 762164d99717433a03474f5e927c58540f5a2863404e3c69f8f83fd04cad624f
This commit is contained in:
parent
7c2954b0ad
commit
649332a422
2 changed files with 8 additions and 9 deletions
|
|
@ -179,9 +179,13 @@ class Symphony::Metronome::ScheduledEvent
|
||||||
# a HUP.
|
# a HUP.
|
||||||
#
|
#
|
||||||
if self.event.recurring
|
if self.event.recurring
|
||||||
now = Time.now
|
now = Time.now
|
||||||
last = self.ds.first[ :lastrun ]
|
row = self.ds.first
|
||||||
return false if last && now - last < self.event.interval
|
|
||||||
|
if row
|
||||||
|
last = row[ :lastrun ]
|
||||||
|
return false if last && now - last < self.event.interval
|
||||||
|
end
|
||||||
|
|
||||||
# Mark the time this recurring event was fired.
|
# Mark the time this recurring event was fired.
|
||||||
self.ds.update( :lastrun => Time.now )
|
self.ds.update( :lastrun => Time.now )
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,6 @@ describe Symphony::Metronome::Scheduler do
|
||||||
described_class.configure
|
described_class.configure
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'spins up an AMQP listener by default' do
|
# needs tests
|
||||||
|
|
||||||
# described_class.run {}
|
|
||||||
# expect( described_class.listen ).to eq( :sd )
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue