sidekiq-cron 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -9
- data/Changes.md +18 -0
- data/Dockerfile +1 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/docker-compose.yml +3 -1
- data/lib/sidekiq/cron/launcher.rb +34 -40
- data/lib/sidekiq/cron/poller.rb +4 -4
- data/lib/sidekiq/cron/web_extension.rb +1 -1
- data/sidekiq-cron.gemspec +4 -4
- data/test/integration/performance_test.rb +3 -5
- data/test/test_helper.rb +1 -1
- data/test/unit/poller_test.rb +1 -3
- data/test/unit/web_extension_test.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb2f152cb3faf85dbc089e10820fd48d7c23f6ad
|
4
|
+
data.tar.gz: 4ced419b5c9ddaeb43a6ebd62221cdbd95eb2c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d882bd7a34f478fc9ea3eb591c6ffe01df2b360ba501ef2df13aa3d7631f77a97a393bc5a391ec682810766dbfe8790bb8a42ed29fc69a666623753103c4c994
|
7
|
+
data.tar.gz: 4bbdf927f3830a9a62e2bf622bf34492555e0a8051f303a0a712eda46a818a5dfd78b5de913e137e39b91f046a05247ae2a133cabe1573fa1b4f21307f721b24
|
data/.travis.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.6
|
4
|
-
- 2.5
|
5
|
-
- 2.4
|
6
|
-
- 2.3
|
7
|
-
- 2.2
|
3
|
+
- 2.6
|
4
|
+
- 2.5
|
5
|
+
- 2.4
|
6
|
+
- 2.3
|
7
|
+
- 2.2
|
8
8
|
services:
|
9
9
|
- redis-server
|
10
10
|
branches:
|
@@ -16,7 +16,3 @@ notifications:
|
|
16
16
|
- ondrej@bartas.cz
|
17
17
|
env:
|
18
18
|
travis: 'yes'
|
19
|
-
matrix:
|
20
|
-
allow_failures:
|
21
|
-
- rvm: jruby-19mode
|
22
|
-
- rvm: rbx-19mode
|
data/Changes.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
v 1.2.0
|
2
|
+
-------
|
3
|
+
|
4
|
+
- updated readme
|
5
|
+
- fix problem with Sidekiq::Launcher and requiring it when not needed
|
6
|
+
- better patching of Sidekiq::Launcher
|
7
|
+
- fixed Dockerfile
|
8
|
+
|
9
|
+
v 1.1.0
|
10
|
+
-------
|
11
|
+
|
12
|
+
- updated readme
|
13
|
+
- fix unit tests - changed argument error when getting invalid cron format
|
14
|
+
- when fallbacking old job enqueued time use `Time.parse` šwithout format (so ruby can decide best method to parse it)
|
15
|
+
- add option `date_as_argument` which will add to your job arguments on last place `Time.now.to_f` when it was eneuqued
|
16
|
+
- add option `description` which will allow you to add notes to your jobs so in web view you can see it
|
17
|
+
- fixed translations
|
18
|
+
|
1
19
|
v 1.0.4
|
2
20
|
-------
|
3
21
|
|
data/Dockerfile
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/docker-compose.yml
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
# require Sidekiq original launcher
|
2
|
-
require 'sidekiq/launcher'
|
3
|
-
|
4
1
|
# require cron poller
|
5
2
|
require 'sidekiq/cron/poller'
|
6
3
|
|
@@ -10,44 +7,41 @@ require 'sidekiq/cron/poller'
|
|
10
7
|
# we are creating new cron poller instance and
|
11
8
|
# adding start and stop commands to launcher
|
12
9
|
module Sidekiq
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
old_quiet
|
10
|
+
module Cron
|
11
|
+
module Launcher
|
12
|
+
# Add cron poller to launcher
|
13
|
+
attr_reader :cron_poller
|
14
|
+
|
15
|
+
# add cron poller and execute normal initialize of Sidekiq launcher
|
16
|
+
def initialize(options)
|
17
|
+
@cron_poller = Sidekiq::Cron::Poller.new
|
18
|
+
super(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# execute normal run of launcher and run cron poller
|
22
|
+
def run
|
23
|
+
super
|
24
|
+
cron_poller.start
|
25
|
+
end
|
26
|
+
|
27
|
+
# execute normal quiet of launcher and quiet cron poller
|
28
|
+
def quiet
|
29
|
+
cron_poller.terminate
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
# execute normal stop of launcher and stop cron poller
|
34
|
+
def stop
|
35
|
+
cron_poller.terminate
|
36
|
+
super
|
37
|
+
end
|
42
38
|
end
|
39
|
+
end
|
40
|
+
end
|
43
41
|
|
44
|
-
|
45
|
-
|
42
|
+
Sidekiq.configure_server do
|
43
|
+
# require Sidekiq original launcher
|
44
|
+
require 'sidekiq/launcher'
|
46
45
|
|
47
|
-
|
48
|
-
def stop
|
49
|
-
cron_poller.terminate
|
50
|
-
old_stop
|
51
|
-
end
|
52
|
-
end
|
46
|
+
::Sidekiq::Launcher.prepend(Sidekiq::Cron::Launcher)
|
53
47
|
end
|
data/lib/sidekiq/cron/poller.rb
CHANGED
@@ -17,8 +17,8 @@ module Sidekiq
|
|
17
17
|
rescue => ex
|
18
18
|
# Most likely a problem with redis networking.
|
19
19
|
# Punt and try again at the next interval
|
20
|
-
logger.error ex.message
|
21
|
-
logger.error ex.backtrace.first
|
20
|
+
Sidekiq.logger.error ex.message
|
21
|
+
Sidekiq.logger.error ex.backtrace.first
|
22
22
|
handle_exception(ex) if respond_to?(:handle_exception)
|
23
23
|
end
|
24
24
|
|
@@ -28,8 +28,8 @@ module Sidekiq
|
|
28
28
|
job.test_and_enque_for_time! time if job && job.valid?
|
29
29
|
rescue => ex
|
30
30
|
# problem somewhere in one job
|
31
|
-
logger.error "CRON JOB: #{ex.message}"
|
32
|
-
logger.error "CRON JOB: #{ex.backtrace.first}"
|
31
|
+
Sidekiq.logger.error "CRON JOB: #{ex.message}"
|
32
|
+
Sidekiq.logger.error "CRON JOB: #{ex.backtrace.first}"
|
33
33
|
handle_exception(ex) if respond_to?(:handle_exception)
|
34
34
|
end
|
35
35
|
|
@@ -25,7 +25,7 @@ module Sidekiq
|
|
25
25
|
view_path = File.join(File.expand_path("..", __FILE__), "views")
|
26
26
|
|
27
27
|
@job = Sidekiq::Cron::Job.find(route_params[:name])
|
28
|
-
if @job
|
28
|
+
if @job
|
29
29
|
#if Slim renderer exists and sidekiq has layout.slim in views
|
30
30
|
if defined?(Slim) && File.exists?(File.join(settings.views,"layout.slim"))
|
31
31
|
render(:slim, File.read(File.join(view_path, "cron_show.slim")))
|
data/sidekiq-cron.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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.
|
5
|
+
# stub: sidekiq-cron 1.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "sidekiq-cron".freeze
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.2.0"
|
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]
|
13
13
|
s.authors = ["Ondrej Bartas".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2020-04-03"
|
15
15
|
s.description = "Enables to set jobs to be run in specified time (using CRON notation)".freeze
|
16
16
|
s.email = "ondrej@bartas.cz".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -57,7 +57,7 @@ Gem::Specification.new do |s|
|
|
57
57
|
]
|
58
58
|
s.homepage = "http://github.com/ondrejbartas/sidekiq-cron".freeze
|
59
59
|
s.licenses = ["MIT".freeze]
|
60
|
-
s.rubygems_version = "2.5.2.
|
60
|
+
s.rubygems_version = "2.5.2.3".freeze
|
61
61
|
s.summary = "Sidekiq Cron helps to add repeated scheduled jobs".freeze
|
62
62
|
|
63
63
|
if s.respond_to? :specification_version then
|
@@ -6,9 +6,7 @@ describe 'Performance Poller' do
|
|
6
6
|
X = 10000
|
7
7
|
before do
|
8
8
|
Sidekiq.redis = REDIS
|
9
|
-
|
10
|
-
conn.flushdb
|
11
|
-
end
|
9
|
+
Redis.current.flushdb
|
12
10
|
|
13
11
|
#clear all previous saved data from redis
|
14
12
|
Sidekiq.redis do |conn|
|
@@ -33,7 +31,7 @@ describe 'Performance Poller' do
|
|
33
31
|
Time.stubs(:now).returns(enqueued_time)
|
34
32
|
end
|
35
33
|
|
36
|
-
it 'should enqueue 10000 jobs in less than
|
34
|
+
it 'should enqueue 10000 jobs in less than 40s' do
|
37
35
|
Sidekiq.redis do |conn|
|
38
36
|
assert_equal 0, conn.llen("queue:default"), 'Queue should be empty'
|
39
37
|
end
|
@@ -47,6 +45,6 @@ describe 'Performance Poller' do
|
|
47
45
|
end
|
48
46
|
|
49
47
|
puts "Performance test finished in #{bench.real}"
|
50
|
-
assert_operator bench.real, :<,
|
48
|
+
assert_operator bench.real, :<, 40
|
51
49
|
end
|
52
50
|
end
|
data/test/test_helper.rb
CHANGED
data/test/unit/poller_test.rb
CHANGED
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: 1.
|
4
|
+
version: 1.2.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: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -339,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
339
|
version: '0'
|
340
340
|
requirements: []
|
341
341
|
rubyforge_project:
|
342
|
-
rubygems_version: 2.5.2.
|
342
|
+
rubygems_version: 2.5.2.3
|
343
343
|
signing_key:
|
344
344
|
specification_version: 4
|
345
345
|
summary: Sidekiq Cron helps to add repeated scheduled jobs
|