lib/sidekiq/cron/job.rb in sidekiq-cron-1.0.3 vs lib/sidekiq/cron/job.rb in sidekiq-cron-1.0.4
- old
+ new
@@ -11,10 +11,11 @@
extend Util
#how long we would like to store informations about previous enqueues
REMEMBER_THRESHOLD = 24 * 60 * 60
LAST_ENQUEUE_TIME_FORMAT = '%Y-%m-%d %H:%M:%S %z'
+ LAST_ENQUEUE_TIME_FORMAT_OLD = '%Y-%m-%d %H:%M:%S'
#crucial part of whole enquing job
def should_enque? time
enqueue = false
enqueue = Sidekiq.redis do |conn|
@@ -550,9 +551,11 @@
end
end
def parse_enqueue_time(timestamp)
DateTime.strptime(timestamp, LAST_ENQUEUE_TIME_FORMAT).to_time.utc
+ rescue ArgumentError
+ DateTime.strptime(timestamp, LAST_ENQUEUE_TIME_FORMAT_OLD).to_time.utc
end
def not_past_scheduled_time?(current_time)
last_cron_time = parsed_cron.previous_time(current_time).utc
# or could it be?