sidekiq-cron 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b73b92bf2df7e62197f67b5458ec5f33a7ee531
4
- data.tar.gz: 3fed6fbd16c45bdba384bf959314ef685dc4bfd5
3
+ metadata.gz: a6e4efebfa16f1bedd09081f160e3db3d778e0b9
4
+ data.tar.gz: b23fe76d331791eabd457cd85f797181bf086712
5
5
  SHA512:
6
- metadata.gz: d7649e1bb970285e696751daf76096832e33de9436c85afea14389335b7653d038896baef7a6f05a81a5222aa680bcb312d1473c4a630677b9e4e1ffde8676e5
7
- data.tar.gz: 66ac5d6377199a03e2e8cd97eb896d9c880088aab7188213515bbb8768bc11ed5856d94e0cd2a808b747624b9840166c621a372fcb04dabcaf37502ba207b50b
6
+ metadata.gz: 3286595909fbc0c05504fb38b12f79544b020a627454701adc8e7b10fd7afc7a27cf27a3edf062b3840eca9e4ebc4964149bc9742e6d1bd85d0177cdea6fe18b
7
+ data.tar.gz: 337457599316fcdec08c10d29fab8b7d130584c345c97f3e4ad2bc93a2c7f2a240689776be8da24d380057ec23481995f0eff456e3789e68a3cc979012f817bf
data/Changes.md CHANGED
@@ -1,3 +1,17 @@
1
+ v 1.0.4
2
+ -------
3
+
4
+ - fix problem with upgrading to 1.0.x - parsing last enqued time didn't count with old time format stored in redis
5
+
6
+ v 1.0.0
7
+ -------
8
+
9
+ - use [fugit](https://github.com/floraison/fugit) instead of [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) - API of cron didn't change (rufus scheduler is using fugit)
10
+ - better working with Timezones
11
+ - translations for JA, zh-CN
12
+ - cron without timezone are considered as UTC, to add Timezone to cron use format `* * * * * Europe/Berlin`
13
+ - be aware that this release can change when your jobs are enqueued (for me it didn't change but it is in one project, in other it can shift by different timezone setup)
14
+
1
15
  v 0.6.0
2
16
  -------
3
17
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -13,6 +13,7 @@ module Sidekiq
13
13
  #how long we would like to store informations about previous enqueues
14
14
  REMEMBER_THRESHOLD = 24 * 60 * 60
15
15
  LAST_ENQUEUE_TIME_FORMAT = '%Y-%m-%d %H:%M:%S %z'
16
+ LAST_ENQUEUE_TIME_FORMAT_OLD = '%Y-%m-%d %H:%M:%S'
16
17
 
17
18
  #crucial part of whole enquing job
18
19
  def should_enque? time
@@ -552,6 +553,8 @@ module Sidekiq
552
553
 
553
554
  def parse_enqueue_time(timestamp)
554
555
  DateTime.strptime(timestamp, LAST_ENQUEUE_TIME_FORMAT).to_time.utc
556
+ rescue ArgumentError
557
+ DateTime.strptime(timestamp, LAST_ENQUEUE_TIME_FORMAT_OLD).to_time.utc
555
558
  end
556
559
 
557
560
  def not_past_scheduled_time?(current_time)
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: sidekiq-cron 1.0.3 ruby lib
5
+ # stub: sidekiq-cron 1.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "sidekiq-cron".freeze
9
- s.version = "1.0.3"
9
+ s.version = "1.0.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -131,6 +131,28 @@ describe "Cron Job" do
131
131
  end
132
132
  end
133
133
 
134
+ describe 'parse_enqueue_time' do
135
+ before do
136
+ @args = {
137
+ name: "Test",
138
+ cron: "* * * * *"
139
+ }
140
+ @job = Sidekiq::Cron::Job.new(@args)
141
+ end
142
+
143
+ it 'should correctly parse new format' do
144
+ assert_equal @job.send(:parse_enqueue_time, '2017-01-02 15:23:43 UTC'), Time.new(2017, 1, 2, 15, 23, 43, '+00:00')
145
+ end
146
+
147
+ it 'should correctly parse new format with different timezone' do
148
+ assert_equal @job.send(:parse_enqueue_time, '2017-01-02 15:23:43 +01:00'), Time.new(2017, 1, 2, 15, 23, 43, '+01:00')
149
+ end
150
+
151
+ it 'should correctly parse old format' do
152
+ assert_equal @job.send(:parse_enqueue_time, '2017-01-02 15:23:43'), Time.new(2017, 1, 2, 15, 23, 43, '+00:00')
153
+ end
154
+ end
155
+
134
156
  describe 'formatted time' do
135
157
  before do
136
158
  @args = {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondrej Bartas