sidekiq-cron 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes.md +5 -0
- data/README.md +3 -1
- data/lib/sidekiq/cron/job.rb +4 -9
- data/lib/sidekiq/cron/locales/pt.yml +22 -0
- data/lib/sidekiq/cron/poller.rb +13 -5
- data/lib/sidekiq/cron/version.rb +1 -1
- data/sidekiq-cron.gemspec +8 -8
- metadata +24 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30fae647f59944364617d071e3e37b7d2d4b8b8153d4cee4aa05a1cfbfe387e5
|
4
|
+
data.tar.gz: c7c6ef11245172570823464e660ce427657ec676e2593b75705deddfed744d5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161fe2edda57f601085515076a2a6375bcf97018124af3993de70fe16624d7b0fcaeefb1cfeac4d0ae5dbc6292ee299faf67a443b7fd8f8e044ed58f118e98f3
|
7
|
+
data.tar.gz: b16fb8618c719b9e9c0d39df2e1b6eb6bbaefe8ce80d1d27fea75f84c9ffc8c3fc9df8860b3409bd3d65eb2b01b3c25917a961ea9911609ed8cff5e6912e2f70
|
data/Changes.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## 1.5.0
|
6
|
+
|
7
|
+
- Integrate Sidekiq v6.5 breaking changes (https://github.com/ondrejbartas/sidekiq-cron/pull/331)
|
8
|
+
- Add portuguese translations (https://github.com/ondrejbartas/sidekiq-cron/pull/332)
|
9
|
+
|
5
10
|
## 1.4.0
|
6
11
|
|
7
12
|
- Fix buttons order in job show view (https://github.com/ondrejbartas/sidekiq-cron/pull/302)
|
data/README.md
CHANGED
@@ -35,6 +35,7 @@ Before upgrading to a new version, please read our [Changelog](Changes.md).
|
|
35
35
|
|
36
36
|
- Redis 2.8 or greater is required (Redis 3.0.3 or greater is recommended for large scale use)
|
37
37
|
- Sidekiq 4.2 or greater is required (for Sidekiq < 4 use version sidekiq-cron 0.3.1)
|
38
|
+
- Sidekiq 6.5 requires Sidekiq-Cron 1.5+
|
38
39
|
|
39
40
|
Install the gem:
|
40
41
|
|
@@ -45,7 +46,7 @@ $ gem install sidekiq-cron
|
|
45
46
|
Or add to your `Gemfile` and run `bundle install`:
|
46
47
|
|
47
48
|
```ruby
|
48
|
-
gem "sidekiq-cron"
|
49
|
+
gem "sidekiq-cron"
|
49
50
|
```
|
50
51
|
|
51
52
|
**NOTE** If you are not using Rails, you need to add `require 'sidekiq-cron'` somewhere after `require 'sidekiq'`.
|
@@ -364,6 +365,7 @@ Sidekiq-Cron is safe to use with multiple Sidekiq processes or nodes. It uses a
|
|
364
365
|
* Start a feature/bugfix branch.
|
365
366
|
* Commit and push until you are happy with your contribution.
|
366
367
|
* Make sure to add tests for it. This is important so we don't break it in a future version unintentionally.
|
368
|
+
* Open a pull request!
|
367
369
|
|
368
370
|
### Testing
|
369
371
|
|
data/lib/sidekiq/cron/job.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
require 'fugit'
|
2
2
|
require 'sidekiq'
|
3
|
-
require 'sidekiq/util'
|
4
3
|
require 'sidekiq/cron/support'
|
5
4
|
|
6
5
|
module Sidekiq
|
7
6
|
module Cron
|
8
|
-
|
9
7
|
class Job
|
10
|
-
include Util
|
11
|
-
extend Util
|
12
|
-
|
13
8
|
#how long we would like to store informations about previous enqueues
|
14
9
|
REMEMBER_THRESHOLD = 24 * 60 * 60
|
15
10
|
LAST_ENQUEUE_TIME_FORMAT = '%Y-%m-%d %H:%M:%S %z'
|
@@ -76,7 +71,7 @@ module Sidekiq
|
|
76
71
|
|
77
72
|
save_last_enqueue_time
|
78
73
|
add_jid_history jid
|
79
|
-
logger.debug { "enqueued #{@name}: #{@message}" }
|
74
|
+
Sidekiq.logger.debug { "enqueued #{@name}: #{@message}" }
|
80
75
|
end
|
81
76
|
|
82
77
|
def is_active_job?
|
@@ -468,7 +463,7 @@ module Sidekiq
|
|
468
463
|
time = Time.now.utc
|
469
464
|
conn.zadd(job_enqueued_key, time.to_f.to_s, formated_last_time(time).to_s) unless conn.public_send(REDIS_EXISTS_METHOD, job_enqueued_key)
|
470
465
|
end
|
471
|
-
logger.info { "Cron Jobs - added job with name: #{@name}" }
|
466
|
+
Sidekiq.logger.info { "Cron Jobs - added job with name: #{@name}" }
|
472
467
|
end
|
473
468
|
|
474
469
|
def save_last_enqueue_time
|
@@ -509,7 +504,7 @@ module Sidekiq
|
|
509
504
|
#delete main job
|
510
505
|
conn.del redis_key
|
511
506
|
end
|
512
|
-
logger.info { "Cron Jobs - deleted job with name: #{@name}" }
|
507
|
+
Sidekiq.logger.info { "Cron Jobs - deleted job with name: #{@name}" }
|
513
508
|
end
|
514
509
|
|
515
510
|
# remove all job from cron
|
@@ -517,7 +512,7 @@ module Sidekiq
|
|
517
512
|
all.each do |job|
|
518
513
|
job.destroy
|
519
514
|
end
|
520
|
-
logger.info { "Cron Jobs - deleted all jobs" }
|
515
|
+
Sidekiq.logger.info { "Cron Jobs - deleted all jobs" }
|
521
516
|
end
|
522
517
|
|
523
518
|
# remove "removed jobs" between current jobs and new jobs
|
@@ -0,0 +1,22 @@
|
|
1
|
+
pt:
|
2
|
+
Job: Tarefa
|
3
|
+
Cron: Cron
|
4
|
+
CronJobs: Tarefas do Cron
|
5
|
+
EnqueueNow: Enfileirar agora
|
6
|
+
EnableAll: Habilitar todos
|
7
|
+
DisableAll: Desabilitar todos
|
8
|
+
EnqueueAll: Enfileirar todos
|
9
|
+
DeleteAll: Excluir todos
|
10
|
+
'Cron string': Cron
|
11
|
+
AreYouSureEnqueueCronJobs: Tem certeza de que deseja enfileirar TODOS as tarefas?
|
12
|
+
AreYouSureEnqueueCronJob: Tem certeza de que deseja enfileirar a tarefa %{job}?
|
13
|
+
AreYouSureDeleteCronJobs: Tem certeza de que deseja excluir TODOS as tarefas?
|
14
|
+
AreYouSureDeleteCronJob: Tem certeza de que deseja excluir a tarefa %{job}?
|
15
|
+
NoCronJobsWereFound: Nenhuma tarefa foi encontrada
|
16
|
+
Enable: Habilitar
|
17
|
+
Disable: Desabilitar
|
18
|
+
'Last enqueued': Último enfileirado
|
19
|
+
disabled: desabilitado
|
20
|
+
enabled: habilitado
|
21
|
+
NoHistoryWereFound: Nenhum histórico foi encontrado
|
22
|
+
Description: Descrição
|
data/lib/sidekiq/cron/poller.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'sidekiq'
|
2
|
-
require 'sidekiq/util'
|
3
2
|
require 'sidekiq/cron'
|
4
3
|
require 'sidekiq/scheduled'
|
5
4
|
|
@@ -9,6 +8,19 @@ module Sidekiq
|
|
9
8
|
|
10
9
|
# The Poller checks Redis every N seconds for sheduled cron jobs
|
11
10
|
class Poller < Sidekiq::Scheduled::Poller
|
11
|
+
def initialize
|
12
|
+
Sidekiq.configure_server do |config|
|
13
|
+
config[:poll_interval_average] = config[:average_scheduled_poll_interval] || POLL_INTERVAL
|
14
|
+
end
|
15
|
+
|
16
|
+
if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("6.5.0")
|
17
|
+
# Sidekiq Poller init requires a config argument
|
18
|
+
super(Sidekiq)
|
19
|
+
else
|
20
|
+
super
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
12
24
|
def enqueue
|
13
25
|
time = Time.now.utc
|
14
26
|
Sidekiq::Cron::Job.all.each do |job|
|
@@ -32,10 +44,6 @@ module Sidekiq
|
|
32
44
|
Sidekiq.logger.error "CRON JOB: #{ex.backtrace.first}"
|
33
45
|
handle_exception(ex) if respond_to?(:handle_exception)
|
34
46
|
end
|
35
|
-
|
36
|
-
def poll_interval_average
|
37
|
-
Sidekiq.options[:average_scheduled_poll_interval] || POLL_INTERVAL
|
38
|
-
end
|
39
47
|
end
|
40
48
|
end
|
41
49
|
end
|
data/lib/sidekiq/cron/version.rb
CHANGED
data/sidekiq-cron.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "sidekiq-cron"
|
7
7
|
s.version = Sidekiq::Cron::VERSION
|
8
8
|
|
9
|
-
s.required_ruby_version = ">= 2.
|
9
|
+
s.required_ruby_version = ">= 2.6"
|
10
10
|
s.require_paths = ["lib"]
|
11
11
|
s.authors = ["Ondrej Bartas"]
|
12
12
|
s.description = "Enables to set jobs to be run in specified time (using CRON notation)"
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.md",
|
24
24
|
"sidekiq-cron.gemspec",
|
25
25
|
]
|
26
|
-
|
26
|
+
|
27
27
|
s.homepage = "https://github.com/ondrejbartas/sidekiq-cron"
|
28
28
|
s.licenses = ["MIT"]
|
29
29
|
s.summary = "Sidekiq-Cron helps to add repeated scheduled jobs"
|
@@ -31,11 +31,11 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_dependency("fugit", "~> 1")
|
32
32
|
s.add_dependency("sidekiq", ">= 4.2.1")
|
33
33
|
|
34
|
-
s.add_development_dependency("minitest")
|
35
|
-
s.add_development_dependency("mocha")
|
36
|
-
s.add_development_dependency("redis-namespace", "
|
37
|
-
s.add_development_dependency("rack", "~> 2.
|
38
|
-
s.add_development_dependency("rack-test", "~> 1.
|
34
|
+
s.add_development_dependency("minitest", "~> 5.15")
|
35
|
+
s.add_development_dependency("mocha", "~> 1.14")
|
36
|
+
s.add_development_dependency("redis-namespace", "~> 1.8")
|
37
|
+
s.add_development_dependency("rack", "~> 2.2")
|
38
|
+
s.add_development_dependency("rack-test", "~> 1.1")
|
39
39
|
s.add_development_dependency("rake", "~> 13.0")
|
40
|
-
s.add_development_dependency("simplecov")
|
40
|
+
s.add_development_dependency("simplecov", "~> 0.21")
|
41
41
|
end
|
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.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: 2022-
|
11
|
+
date: 2022-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fugit
|
@@ -42,72 +42,72 @@ dependencies:
|
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.15'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.15'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.14'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.14'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redis-namespace
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: '1.8'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: '1.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '2.
|
89
|
+
version: '2.2'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '2.
|
96
|
+
version: '2.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rack-test
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.1'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '0.21'
|
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: '0'
|
138
|
+
version: '0.21'
|
139
139
|
description: Enables to set jobs to be run in specified time (using CRON notation)
|
140
140
|
email: ondrej@bartas.cz
|
141
141
|
executables: []
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/sidekiq/cron/locales/de.yml
|
157
157
|
- lib/sidekiq/cron/locales/en.yml
|
158
158
|
- lib/sidekiq/cron/locales/ja.yml
|
159
|
+
- lib/sidekiq/cron/locales/pt.yml
|
159
160
|
- lib/sidekiq/cron/locales/ru.yml
|
160
161
|
- lib/sidekiq/cron/locales/zh-CN.yml
|
161
162
|
- lib/sidekiq/cron/poller.rb
|
@@ -183,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
184
|
requirements:
|
184
185
|
- - ">="
|
185
186
|
- !ruby/object:Gem::Version
|
186
|
-
version: '2.
|
187
|
+
version: '2.6'
|
187
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
189
|
requirements:
|
189
190
|
- - ">="
|