sidekiq-cron 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +32 -0
- data/Gemfile +1 -1
- data/README.md +10 -2
- data/VERSION +1 -1
- data/docker-compose.yml +21 -0
- data/lib/sidekiq/cron/job.rb +8 -8
- data/lib/sidekiq/cron/poller.rb +4 -3
- data/sidekiq-cron.gemspec +66 -64
- data/test/unit/job_test.rb +7 -7
- data/test/unit/poller_test.rb +4 -4
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bb12eff027f95cda75d6c0716c53aa4aa8b3ff2
|
4
|
+
data.tar.gz: 5deeb1b713be5c96f55e225bb9dfbe60b18e7211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8378eacc4fc05c67790f7c8473174be1c63af614ddb5136ec2cc6df8cd7b31d268dd2e936f857af14ce0e4c2df494de9cbfc8f74d39ff2a75ec4779931cbe78f
|
7
|
+
data.tar.gz: 61b0e2dca5bc749756079d201ab6eae043bed2376e02bb61753453cb6b73195b5ada01c19605772e78f00ca73ae132d88773276c4fd4636bade7ac1177d2daec
|
data/Dockerfile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
FROM ruby:2.3.1
|
2
|
+
MAINTAINER Joao Serra <joaopfserra@gmail.com>
|
3
|
+
|
4
|
+
RUN apt-get update && \
|
5
|
+
apt-get install -y --force-yes \
|
6
|
+
curl \
|
7
|
+
git \
|
8
|
+
wget \
|
9
|
+
libpq-dev && \
|
10
|
+
apt-get autoremove -y --force-yes && \
|
11
|
+
apt-get clean && \
|
12
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
13
|
+
|
14
|
+
ENV DOCKERIZE_VERSION v0.2.0
|
15
|
+
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
16
|
+
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
17
|
+
|
18
|
+
RUN gem install bundler
|
19
|
+
|
20
|
+
ENV APP_HOME /sidekiq-cron
|
21
|
+
RUN mkdir $APP_HOME
|
22
|
+
WORKDIR $APP_HOME
|
23
|
+
|
24
|
+
ADD Gemfile* $APP_HOME/
|
25
|
+
|
26
|
+
ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
|
27
|
+
BUNDLE_JOBS=2 \
|
28
|
+
BUNDLE_PATH=/bundle
|
29
|
+
|
30
|
+
RUN bundle install
|
31
|
+
|
32
|
+
ADD . $APP_HOME
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,8 @@ Sidekiq-Cron [![Gem Version](https://badge.fury.io/rb/sidekiq-cron.svg)](http://
|
|
3
3
|
|
4
4
|
[![Join the chat at https://gitter.im/ondrejbartas/sidekiq-cron](https://badges.gitter.im/ondrejbartas/sidekiq-cron.svg)](https://gitter.im/ondrejbartas/sidekiq-cron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
5
|
|
6
|
+
[Introduction video about Sidekiq-Cron by Drifting Ruby](https://www.driftingruby.com/episodes/periodic-tasks-with-sidekiq-cron)
|
7
|
+
|
6
8
|
A scheduling add-on for [Sidekiq](http://sidekiq.org).
|
7
9
|
|
8
10
|
Runs a thread alongside Sidekiq workers to schedule jobs at specified times (using cron notation `* * * * *` parsed by [Rufus-Scheduler](https://github.com/jmettraux/rufus-scheduler), more about [cron notation](http://www.nncron.ru/help/EN/working/cron-format.htm).
|
@@ -15,6 +17,8 @@ If you want to know how scheduling work, check out [under the hood](#under-the-h
|
|
15
17
|
|
16
18
|
Works with ActiveJob (Rails 4.2+)
|
17
19
|
|
20
|
+
You don't need Sidekiq PRO, you can use this gem with plain __Sidekiq__.
|
21
|
+
|
18
22
|
Requirements
|
19
23
|
-----------------
|
20
24
|
|
@@ -60,7 +64,11 @@ _Job properties_:
|
|
60
64
|
|
61
65
|
### Time, cron and sidekiq-cron
|
62
66
|
|
63
|
-
sidekiq-cron uses [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) to parse the cronline.
|
67
|
+
sidekiq-cron uses [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) to parse the cronline.
|
68
|
+
By default, the timezone this is evaluated against UTC.
|
69
|
+
If you want to have your jobs enqueued based on a different time zone you can specify a timezone in the cronline,
|
70
|
+
like this `'0 22 * * 1-5 America/Chicago'`.
|
71
|
+
See [rufus-scheduler documentation](https://github.com/jmettraux/rufus-scheduler#a-note-about-timezones) for more information.
|
64
72
|
|
65
73
|
### What objects/classes can be scheduled
|
66
74
|
#### Sidekiq Worker
|
@@ -156,7 +164,7 @@ Sidekiq::Cron::Job.load_from_array array
|
|
156
164
|
```
|
157
165
|
|
158
166
|
Bang-suffixed methods will remove jobs that are not present in the given hash/array,
|
159
|
-
|
167
|
+
update jobs that have the same names, and create new ones when the names are previously unknown.
|
160
168
|
|
161
169
|
```ruby
|
162
170
|
Sidekiq::Cron::Job#load_from_hash! hash
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
version: '2'
|
2
|
+
services:
|
3
|
+
common:
|
4
|
+
build:
|
5
|
+
context: .
|
6
|
+
image: sidekiq-cron-test
|
7
|
+
environment: &environment
|
8
|
+
- REDIS_URL=redis://redis.test:6379/0
|
9
|
+
dns:
|
10
|
+
- 8.8.8.8
|
11
|
+
- 8.8.4.4
|
12
|
+
redis:
|
13
|
+
image: redis
|
14
|
+
tests:
|
15
|
+
image: sidekiq-cron-test
|
16
|
+
environment: *environment
|
17
|
+
links:
|
18
|
+
- redis:redis.test
|
19
|
+
depends_on:
|
20
|
+
- common
|
21
|
+
command: dockerize -wait tcp://redis.test:6379 -timeout 60s rake test
|
data/lib/sidekiq/cron/job.rb
CHANGED
@@ -44,7 +44,7 @@ module Sidekiq
|
|
44
44
|
end
|
45
45
|
|
46
46
|
#enque cron job to queue
|
47
|
-
def enque! time = Time.now
|
47
|
+
def enque! time = Time.now.utc
|
48
48
|
@last_enqueue_time = time
|
49
49
|
|
50
50
|
klass_const =
|
@@ -397,7 +397,7 @@ module Sidekiq
|
|
397
397
|
else
|
398
398
|
begin
|
399
399
|
cron = Rufus::Scheduler::CronLine.new(@cron)
|
400
|
-
cron.next_time(Time.now)
|
400
|
+
cron.next_time(Time.now.utc).utc
|
401
401
|
rescue Exception => e
|
402
402
|
#fix for different versions of cron-parser
|
403
403
|
if e.message == "Bad Vixie-style specification bad"
|
@@ -445,7 +445,7 @@ module Sidekiq
|
|
445
445
|
conn.hmset redis_key, *hash_to_redis(to_hash)
|
446
446
|
|
447
447
|
#add information about last time! - don't enque right after scheduler poller starts!
|
448
|
-
time = Time.now
|
448
|
+
time = Time.now.utc
|
449
449
|
conn.zadd(job_enqueued_key, time.to_f.to_s, formated_last_time(time).to_s) unless conn.exists(job_enqueued_key)
|
450
450
|
end
|
451
451
|
logger.info { "Cron Jobs - add job with name: #{@name}" }
|
@@ -486,15 +486,15 @@ module Sidekiq
|
|
486
486
|
|
487
487
|
# Parse cron specification '* * * * *' and returns
|
488
488
|
# time when last run should be performed
|
489
|
-
def last_time now = Time.now
|
490
|
-
Rufus::Scheduler::CronLine.new(@cron).previous_time(now)
|
489
|
+
def last_time now = Time.now.utc
|
490
|
+
Rufus::Scheduler::CronLine.new(@cron).previous_time(now.utc).utc
|
491
491
|
end
|
492
492
|
|
493
|
-
def formated_enqueue_time now = Time.now
|
493
|
+
def formated_enqueue_time now = Time.now.utc
|
494
494
|
last_time(now).getutc.to_f.to_s
|
495
495
|
end
|
496
496
|
|
497
|
-
def formated_last_time now = Time.now
|
497
|
+
def formated_last_time now = Time.now.utc
|
498
498
|
last_time(now).getutc.iso8601
|
499
499
|
end
|
500
500
|
|
@@ -542,7 +542,7 @@ module Sidekiq
|
|
542
542
|
end
|
543
543
|
|
544
544
|
def not_past_scheduled_time?(current_time)
|
545
|
-
last_cron_time = Rufus::Scheduler::CronLine.new(@cron).previous_time(current_time)
|
545
|
+
last_cron_time = Rufus::Scheduler::CronLine.new(@cron).previous_time(current_time).utc
|
546
546
|
return false if (current_time.to_i - last_cron_time.to_i) > 60
|
547
547
|
true
|
548
548
|
end
|
data/lib/sidekiq/cron/poller.rb
CHANGED
@@ -8,8 +8,9 @@ module Sidekiq
|
|
8
8
|
# The Poller checks Redis every N seconds for sheduled cron jobs
|
9
9
|
class Poller < Sidekiq::Scheduled::Poller
|
10
10
|
def enqueue
|
11
|
+
time = Time.now.utc
|
11
12
|
Sidekiq::Cron::Job.all.each do |job|
|
12
|
-
enqueue_job(job)
|
13
|
+
enqueue_job(job, time)
|
13
14
|
end
|
14
15
|
rescue => ex
|
15
16
|
# Most likely a problem with redis networking.
|
@@ -20,8 +21,8 @@ module Sidekiq
|
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
|
-
def enqueue_job(job)
|
24
|
-
job.test_and_enque_for_time!
|
24
|
+
def enqueue_job(job, time = Time.now.utc)
|
25
|
+
job.test_and_enque_for_time! time if job && job.valid?
|
25
26
|
rescue => ex
|
26
27
|
# problem somewhere in one job
|
27
28
|
logger.error "CRON JOB: #{ex.message}"
|
data/sidekiq-cron.gemspec
CHANGED
@@ -2,18 +2,18 @@
|
|
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 0.
|
5
|
+
# stub: sidekiq-cron 0.5.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "sidekiq-cron"
|
9
|
-
s.version = "0.
|
8
|
+
s.name = "sidekiq-cron"
|
9
|
+
s.version = "0.5.0"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0"
|
12
|
-
s.require_paths = ["lib"
|
13
|
-
s.authors = ["Ondrej Bartas"
|
14
|
-
s.date = "
|
15
|
-
s.description = "Enables to set jobs to be run in specified time (using CRON notation)"
|
16
|
-
s.email = "ondrej@bartas.cz"
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Ondrej Bartas"]
|
14
|
+
s.date = "2017-04-13"
|
15
|
+
s.description = "Enables to set jobs to be run in specified time (using CRON notation)"
|
16
|
+
s.email = "ondrej@bartas.cz"
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
19
|
"README.md"
|
@@ -22,12 +22,14 @@ Gem::Specification.new do |s|
|
|
22
22
|
".document",
|
23
23
|
".travis.yml",
|
24
24
|
"Changes.md",
|
25
|
+
"Dockerfile",
|
25
26
|
"Gemfile",
|
26
27
|
"LICENSE.txt",
|
27
28
|
"README.md",
|
28
29
|
"Rakefile",
|
29
30
|
"VERSION",
|
30
31
|
"config.ru",
|
32
|
+
"docker-compose.yml",
|
31
33
|
"examples/web-cron-ui.png",
|
32
34
|
"lib/sidekiq-cron.rb",
|
33
35
|
"lib/sidekiq/cron.rb",
|
@@ -47,69 +49,69 @@ Gem::Specification.new do |s|
|
|
47
49
|
"test/unit/poller_test.rb",
|
48
50
|
"test/unit/web_extension_test.rb"
|
49
51
|
]
|
50
|
-
s.homepage = "http://github.com/ondrejbartas/sidekiq-cron"
|
51
|
-
s.licenses = ["MIT"
|
52
|
-
s.rubygems_version = "2.
|
53
|
-
s.summary = "Sidekiq Cron helps to add repeated scheduled jobs"
|
52
|
+
s.homepage = "http://github.com/ondrejbartas/sidekiq-cron"
|
53
|
+
s.licenses = ["MIT"]
|
54
|
+
s.rubygems_version = "2.4.5"
|
55
|
+
s.summary = "Sidekiq Cron helps to add repeated scheduled jobs"
|
54
56
|
|
55
57
|
if s.respond_to? :specification_version then
|
56
58
|
s.specification_version = 4
|
57
59
|
|
58
60
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
59
|
-
s.add_runtime_dependency(%q<sidekiq
|
60
|
-
s.add_runtime_dependency(%q<rufus-scheduler
|
61
|
-
s.add_runtime_dependency(%q<redis-namespace
|
62
|
-
s.add_development_dependency(%q<bundler
|
63
|
-
s.add_development_dependency(%q<simplecov
|
64
|
-
s.add_development_dependency(%q<shoulda-context
|
65
|
-
s.add_development_dependency(%q<rack
|
66
|
-
s.add_development_dependency(%q<rack-test
|
67
|
-
s.add_development_dependency(%q<jeweler
|
68
|
-
s.add_development_dependency(%q<minitest
|
69
|
-
s.add_development_dependency(%q<test-unit
|
70
|
-
s.add_development_dependency(%q<sdoc
|
71
|
-
s.add_development_dependency(%q<slim
|
72
|
-
s.add_development_dependency(%q<sinatra
|
73
|
-
s.add_development_dependency(%q<mocha
|
74
|
-
s.add_development_dependency(%q<coveralls
|
75
|
-
s.add_development_dependency(%q<shotgun
|
61
|
+
s.add_runtime_dependency(%q<sidekiq>, [">= 4.2.1"])
|
62
|
+
s.add_runtime_dependency(%q<rufus-scheduler>, [">= 3.3.0"])
|
63
|
+
s.add_runtime_dependency(%q<redis-namespace>, [">= 1.5.2"])
|
64
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<shoulda-context>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<rack>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
70
|
+
s.add_development_dependency(%q<minitest>, [">= 0"])
|
71
|
+
s.add_development_dependency(%q<test-unit>, [">= 0"])
|
72
|
+
s.add_development_dependency(%q<sdoc>, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<slim>, [">= 0"])
|
74
|
+
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
75
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
76
|
+
s.add_development_dependency(%q<coveralls>, [">= 0"])
|
77
|
+
s.add_development_dependency(%q<shotgun>, [">= 0"])
|
76
78
|
else
|
77
|
-
s.add_dependency(%q<sidekiq
|
78
|
-
s.add_dependency(%q<rufus-scheduler
|
79
|
-
s.add_dependency(%q<redis-namespace
|
80
|
-
s.add_dependency(%q<bundler
|
81
|
-
s.add_dependency(%q<simplecov
|
82
|
-
s.add_dependency(%q<shoulda-context
|
83
|
-
s.add_dependency(%q<rack
|
84
|
-
s.add_dependency(%q<rack-test
|
85
|
-
s.add_dependency(%q<jeweler
|
86
|
-
s.add_dependency(%q<minitest
|
87
|
-
s.add_dependency(%q<test-unit
|
88
|
-
s.add_dependency(%q<sdoc
|
89
|
-
s.add_dependency(%q<slim
|
90
|
-
s.add_dependency(%q<sinatra
|
91
|
-
s.add_dependency(%q<mocha
|
92
|
-
s.add_dependency(%q<coveralls
|
93
|
-
s.add_dependency(%q<shotgun
|
79
|
+
s.add_dependency(%q<sidekiq>, [">= 4.2.1"])
|
80
|
+
s.add_dependency(%q<rufus-scheduler>, [">= 3.3.0"])
|
81
|
+
s.add_dependency(%q<redis-namespace>, [">= 1.5.2"])
|
82
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
83
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
84
|
+
s.add_dependency(%q<shoulda-context>, [">= 0"])
|
85
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
87
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
88
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
89
|
+
s.add_dependency(%q<test-unit>, [">= 0"])
|
90
|
+
s.add_dependency(%q<sdoc>, [">= 0"])
|
91
|
+
s.add_dependency(%q<slim>, [">= 0"])
|
92
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
93
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
94
|
+
s.add_dependency(%q<coveralls>, [">= 0"])
|
95
|
+
s.add_dependency(%q<shotgun>, [">= 0"])
|
94
96
|
end
|
95
97
|
else
|
96
|
-
s.add_dependency(%q<sidekiq
|
97
|
-
s.add_dependency(%q<rufus-scheduler
|
98
|
-
s.add_dependency(%q<redis-namespace
|
99
|
-
s.add_dependency(%q<bundler
|
100
|
-
s.add_dependency(%q<simplecov
|
101
|
-
s.add_dependency(%q<shoulda-context
|
102
|
-
s.add_dependency(%q<rack
|
103
|
-
s.add_dependency(%q<rack-test
|
104
|
-
s.add_dependency(%q<jeweler
|
105
|
-
s.add_dependency(%q<minitest
|
106
|
-
s.add_dependency(%q<test-unit
|
107
|
-
s.add_dependency(%q<sdoc
|
108
|
-
s.add_dependency(%q<slim
|
109
|
-
s.add_dependency(%q<sinatra
|
110
|
-
s.add_dependency(%q<mocha
|
111
|
-
s.add_dependency(%q<coveralls
|
112
|
-
s.add_dependency(%q<shotgun
|
98
|
+
s.add_dependency(%q<sidekiq>, [">= 4.2.1"])
|
99
|
+
s.add_dependency(%q<rufus-scheduler>, [">= 3.3.0"])
|
100
|
+
s.add_dependency(%q<redis-namespace>, [">= 1.5.2"])
|
101
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
102
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
103
|
+
s.add_dependency(%q<shoulda-context>, [">= 0"])
|
104
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
105
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
106
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
107
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
108
|
+
s.add_dependency(%q<test-unit>, [">= 0"])
|
109
|
+
s.add_dependency(%q<sdoc>, [">= 0"])
|
110
|
+
s.add_dependency(%q<slim>, [">= 0"])
|
111
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
112
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
113
|
+
s.add_dependency(%q<coveralls>, [">= 0"])
|
114
|
+
s.add_dependency(%q<shotgun>, [">= 0"])
|
113
115
|
end
|
114
116
|
end
|
115
117
|
|
data/test/unit/job_test.rb
CHANGED
@@ -210,24 +210,24 @@ describe "Cron Job" do
|
|
210
210
|
|
211
211
|
it "return previous minute" do
|
212
212
|
@job.cron = "* * * * *"
|
213
|
-
time = Time.now
|
213
|
+
time = Time.now.utc
|
214
214
|
assert_equal @job.last_time(time).strftime("%Y-%m-%d-%H-%M-%S"), time.strftime("%Y-%m-%d-%H-%M-00")
|
215
215
|
end
|
216
216
|
|
217
217
|
it "return previous hour" do
|
218
218
|
@job.cron = "1 * * * *"
|
219
|
-
time = Time.now
|
219
|
+
time = Time.now.utc
|
220
220
|
assert_equal @job.last_time(time).strftime("%Y-%m-%d-%H-%M-%S"), time.strftime("%Y-%m-%d-%H-01-00")
|
221
221
|
end
|
222
222
|
|
223
223
|
it "return previous day" do
|
224
|
-
@job.cron = "1 2 * * *"
|
225
|
-
time = Time.now
|
224
|
+
@job.cron = "1 2 * * * Etc/GMT"
|
225
|
+
time = Time.now.utc
|
226
226
|
|
227
227
|
if time.hour >= 2
|
228
228
|
assert_equal @job.last_time(time).strftime("%Y-%m-%d-%H-%M-%S"), time.strftime("%Y-%m-%d-02-01-00")
|
229
229
|
else
|
230
|
-
yesterday = Date.today - 1
|
230
|
+
yesterday = (Date.today - 1)
|
231
231
|
assert_equal @job.last_time(time).strftime("%Y-%m-%d-%H-%M-%S"), yesterday.strftime("%Y-%m-%d-02-01-00")
|
232
232
|
end
|
233
233
|
end
|
@@ -777,7 +777,7 @@ describe "Cron Job" do
|
|
777
777
|
}
|
778
778
|
#first time is allways
|
779
779
|
#after next cron time!
|
780
|
-
@time = Time.now + 120
|
780
|
+
@time = Time.now.utc + 120
|
781
781
|
end
|
782
782
|
it "be allways false when status is disabled" do
|
783
783
|
refute Sidekiq::Cron::Job.new(@args.merge(status: 'disabled')).should_enque? @time
|
@@ -816,7 +816,7 @@ describe "Cron Job" do
|
|
816
816
|
assert job.test_and_enque_for_time!(@time), "should enqueue"
|
817
817
|
|
818
818
|
future_now = @time + 1 * 60 * 60
|
819
|
-
Time.stubs(:now).returns(future_now) # save uses Time.now
|
819
|
+
Time.stubs(:now).returns(future_now) # save uses Time.now.utc
|
820
820
|
job.save
|
821
821
|
assert Sidekiq::Cron::Job.new(@args).test_and_enque_for_time!(future_now + 30), "should enqueue"
|
822
822
|
end
|
data/test/unit/poller_test.rb
CHANGED
@@ -28,7 +28,7 @@ describe 'Cron Poller' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'not enqueue any job - new jobs' do
|
31
|
-
now = Time.now
|
31
|
+
now = Time.now.utc
|
32
32
|
enqueued_time = Time.new(now.year, now.month, now.day, now.hour + 1, 5, 1)
|
33
33
|
Time.stubs(:now).returns(enqueued_time)
|
34
34
|
#new jobs!
|
@@ -54,7 +54,7 @@ describe 'Cron Poller' do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should enqueue only job with cron */2' do
|
57
|
-
now = Time.now
|
57
|
+
now = Time.now.utc
|
58
58
|
enqueued_time = Time.new(now.year, now.month, now.day, now.hour + 1, 5, 1)
|
59
59
|
Time.stubs(:now).returns(enqueued_time)
|
60
60
|
#new jobs!
|
@@ -79,7 +79,7 @@ describe 'Cron Poller' do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'should enqueue both jobs' do
|
82
|
-
now = Time.now
|
82
|
+
now = Time.now.utc
|
83
83
|
enqueued_time = Time.new(now.year, now.month, now.day, now.hour + 1, 8, 1)
|
84
84
|
Time.stubs(:now).returns(enqueued_time)
|
85
85
|
#new jobs!
|
@@ -104,7 +104,7 @@ describe 'Cron Poller' do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should enqueue both jobs but only one time each' do
|
107
|
-
now = Time.now
|
107
|
+
now = Time.now.utc
|
108
108
|
enqueued_time = Time.new(now.year, now.month, now.day, now.hour + 1, 8, 1)
|
109
109
|
Time.stubs(:now).returns(enqueued_time)
|
110
110
|
#new jobs!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-cron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondrej Bartas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: redis-namespace
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: jeweler
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: minitest
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -259,12 +259,14 @@ files:
|
|
259
259
|
- ".document"
|
260
260
|
- ".travis.yml"
|
261
261
|
- Changes.md
|
262
|
+
- Dockerfile
|
262
263
|
- Gemfile
|
263
264
|
- LICENSE.txt
|
264
265
|
- README.md
|
265
266
|
- Rakefile
|
266
267
|
- VERSION
|
267
268
|
- config.ru
|
269
|
+
- docker-compose.yml
|
268
270
|
- examples/web-cron-ui.png
|
269
271
|
- lib/sidekiq-cron.rb
|
270
272
|
- lib/sidekiq/cron.rb
|