sidekiq-scheduler 5.0.3 → 5.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -2
- data/README.md +11 -6
- data/lib/sidekiq-scheduler/config.rb +11 -0
- data/lib/sidekiq-scheduler/extensions/web.rb +20 -7
- data/lib/sidekiq-scheduler/job_presenter.rb +1 -1
- data/lib/sidekiq-scheduler/manager.rb +9 -0
- data/lib/sidekiq-scheduler/redis_manager.rb +4 -4
- data/lib/sidekiq-scheduler/schedule.rb +1 -1
- data/lib/sidekiq-scheduler/scheduler.rb +22 -6
- data/lib/sidekiq-scheduler/sidekiq_adapter.rb +1 -0
- data/lib/sidekiq-scheduler/utils.rb +37 -1
- data/lib/sidekiq-scheduler/version.rb +1 -1
- data/web/locales/cs.yml +1 -0
- data/web/locales/de.yml +1 -0
- data/web/locales/en.yml +1 -0
- data/web/locales/es.yml +1 -0
- data/web/locales/fr.yml +1 -0
- data/web/locales/gd.yml +1 -0
- data/web/locales/it.yml +1 -0
- data/web/locales/ja.yml +1 -0
- data/web/locales/nl.yml +1 -0
- data/web/locales/pl.yml +1 -0
- data/web/locales/pt-BR.yml +2 -1
- data/web/locales/ru.yml +1 -0
- data/web/locales/sv.yml +1 -0
- data/web/locales/zh-cn.yml +1 -0
- data/web/views/recurring_jobs.erb +3 -38
- metadata +15 -8
- /data/web/assets/{stylesheets-scheduler → recurring_jobs/stylesheets-scheduler}/recurring_jobs.css +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2d6cf0887d66e27d2ce10ec96eabcb2b89bd89c515af8e38d54b366b38a8df2
|
|
4
|
+
data.tar.gz: c0da1db9ad45afdaf3b6055ce22ccc24ac90a392f7a2b5787136bbdeb6456fd5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d845a756d2ba958cfedadcf52f6ba6f19811eb5b88c94fc50989b6a6f2bf523dbc7d2f8eb8e44c9d0c20a483f5896e5c313e5428f2369368de12479a2472163
|
|
7
|
+
data.tar.gz: 797ebac76066faa408f2f43290f6aead6a4ff335cb966811efdeea5c70c7ca5a4f93e6bda15f864987294e505583999bff64d05f33f2f2b9d0c92f512487d905
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# 5.0.6
|
|
2
|
+
- [**FIX**] Fix typo in `config#to_hash` method [#479](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/479)
|
|
3
|
+
- [**FIX**] Correctly clear scheduled jobs with Scheduler#clear_schedule! [#485](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/485)
|
|
4
|
+
- [**FIX**] Fix scheduling of aperiodic cron jobs [#487](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/487) (see [#484](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/484) for more details as well)
|
|
5
|
+
|
|
6
|
+
# 5.0.5
|
|
7
|
+
- [**FIX**] Use correct folder structure for assets [#476](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/476)
|
|
8
|
+
|
|
9
|
+
# 5.0.4
|
|
10
|
+
- [**FIX**] Ensure rufus-scheduler has a default rufus_scheduler_options value [#434](https://github.com/sidekiq-scheduler/sidekiq-scheduler/issues/426)
|
|
11
|
+
- [**ENHANCEMENT**] Remove code related to sidekiq < 6 [#443](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/443)
|
|
12
|
+
- [**ENHANCEMENT**] Change cache-control to `private` [#446](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/446)
|
|
13
|
+
- [**ENHANCEMENT**] Increase compatibility range with tilt dependency [#458](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/458)
|
|
14
|
+
- [**ENHANCEMENT**] Ensure we support Ruby 3.3 [#461](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/461)
|
|
15
|
+
- [**ENHANCEMENT**] Use Redis MULTI command (https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/464)
|
|
16
|
+
- [**ENHANCEMENT**] Don't attempt to set jon next_time when job is nil [#466](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/466)
|
|
17
|
+
- [**ENHANCEMENT**] Improvements to prevent jobs been enqueued multiple times due to a delay in job execution [#463](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/463)
|
|
18
|
+
- [**FIX**] Prevent stack level too deep error by implementing `to_hash` method [#470](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/470)
|
|
19
|
+
- [**ENHANCEMENT**] Support new Sidekiq model for registering UI plugins [#472](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/472)
|
|
20
|
+
- [**ENHANCEMENT**] Stop testing against Ruby 2.7 and 3.0 [#472](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/472#discussion_r1663197863)
|
|
21
|
+
- [**ENHANCEMENT**] Display `at` and `in` in the dashboard [#291](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/291)
|
|
22
|
+
- [**ENHANCEMENT**] Docs enhancements [#442](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/442), [#449](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/449), [#457](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/457), [#465](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/465), [58e1835](https://github.com/sidekiq-scheduler/sidekiq-scheduler/commit/58e18351054fc3c264b2b5a684173316f674c386)
|
|
23
|
+
|
|
24
|
+
|
|
1
25
|
# 5.0.3
|
|
2
26
|
|
|
3
27
|
- [**FIX**] Fix "uppercase character in header name: Cache-Control" [#432](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/432)
|
|
@@ -19,7 +43,7 @@
|
|
|
19
43
|
|
|
20
44
|
# 5.0.0
|
|
21
45
|
|
|
22
|
-
- [**FIX**] Ensure generated scheduled time has a precision of 3
|
|
46
|
+
- [**FIX**] Ensure generated scheduled time has a precision of 3 milliseconds. [#418](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/418)
|
|
23
47
|
|
|
24
48
|
*Note 1:* Check [# 5.0.0.beta1](#500beta1) & [# 5.0.0.beta2](#500beta2) releases for breaking changes.
|
|
25
49
|
|
|
@@ -72,6 +96,6 @@
|
|
|
72
96
|
- [**ENHANCEMENT**] Highlight disabled jobs [#369](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/369)
|
|
73
97
|
- [**BREAKING CHANGE**] Require redis 4.2.0 [#370](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/370)
|
|
74
98
|
- [**FIX**] Fixes redis deprecation warning regarding `exists` [#370](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/370)
|
|
75
|
-
- [**BREAKING CHANGE**] Remove
|
|
99
|
+
- [**BREAKING CHANGE**] Remove dependency on thwait and e2mmap [#371](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/371)
|
|
76
100
|
- Support Ruby 3.1 [#373](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/373)
|
|
77
101
|
- [**BREAKING CHANGE**] Set rufus_scheduler_options via sidekiq.yml file as configuration option [#375](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/375)
|
data/README.md
CHANGED
|
@@ -45,6 +45,8 @@ class HelloWorld
|
|
|
45
45
|
end
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
__Note:__ In Sidekiq v6.3 `Sidekiq::Job` was introduced as an alias for `Sidekiq::Worker`. `Sidekiq::Worker` has been officially deprecated in Sidekiq v7 although it still exists for backwards compatibility. It is therefore recommended to use `include Sidekiq::Job` in the above example unless an older version of Sidekiq is required.
|
|
49
|
+
|
|
48
50
|
``` yaml
|
|
49
51
|
# config/sidekiq.yml
|
|
50
52
|
|
|
@@ -55,6 +57,9 @@ end
|
|
|
55
57
|
class: HelloWorld
|
|
56
58
|
```
|
|
57
59
|
|
|
60
|
+
> [!NOTE]
|
|
61
|
+
> sidekiq-scheduler uses [fugit](https://github.com/floraison/fugit) under the hood, which supports up to six arguments as the cron string, [see](https://github.com/floraison/fugit?tab=readme-ov-file#the-second-extension).
|
|
62
|
+
|
|
58
63
|
Run sidekiq:
|
|
59
64
|
|
|
60
65
|
``` sh
|
|
@@ -122,7 +127,7 @@ The schedule is configured through the `:scheduler:` -> `:schedule` config entry
|
|
|
122
127
|
|
|
123
128
|
# Deconstructs a hash defined as the `args` to keyword arguments.
|
|
124
129
|
#
|
|
125
|
-
# `
|
|
130
|
+
# `false` by default.
|
|
126
131
|
#
|
|
127
132
|
# Example
|
|
128
133
|
#
|
|
@@ -208,7 +213,7 @@ At, and in types push jobs only once. `at` schedules in a point in time:
|
|
|
208
213
|
at: '3001/01/01'
|
|
209
214
|
```
|
|
210
215
|
|
|
211
|
-
You can specify any string that `DateTime.parse` and `Chronic` understand. To enable Chronic
|
|
216
|
+
You can specify any string that `DateTime.parse` and `Chronic` understand. To enable [Chronic](https://github.com/mojombo/chronic)
|
|
212
217
|
strings, you must add it as a dependency.
|
|
213
218
|
|
|
214
219
|
`in` triggers after a time duration has elapsed:
|
|
@@ -332,7 +337,7 @@ You can also override the thread pool size in Rufus Scheduler by setting the fol
|
|
|
332
337
|
## Notes about running on Multiple Hosts
|
|
333
338
|
|
|
334
339
|
Under normal conditions, `cron` and `at` jobs are pushed once regardless of the number of `sidekiq-scheduler` running instances,
|
|
335
|
-
|
|
340
|
+
assuming that time deltas between hosts is less than 24 hours.
|
|
336
341
|
|
|
337
342
|
Non-normal conditions that could push a specific job multiple times are:
|
|
338
343
|
- high cpu load + a high number of jobs scheduled at the same time, like 100 jobs
|
|
@@ -359,7 +364,7 @@ MyRegularJob:
|
|
|
359
364
|
Then we can conditionally load it via an initializer:
|
|
360
365
|
|
|
361
366
|
```ruby
|
|
362
|
-
# config/
|
|
367
|
+
# config/initializers/sidekiq.rb
|
|
363
368
|
if ENV.fetch("IS_SCHEDULER", false)
|
|
364
369
|
Sidekiq.configure_server do |config|
|
|
365
370
|
config.on(:startup) do
|
|
@@ -489,7 +494,7 @@ end
|
|
|
489
494
|
|
|
490
495
|
## The Spring preloader and Testing your initializer via Rails console
|
|
491
496
|
|
|
492
|
-
If you're pulling in your schedule from a YML file via an initializer as shown, be aware that the Spring application preloader included with Rails will
|
|
497
|
+
If you're pulling in your schedule from a YML file via an initializer as shown, be aware that the Spring application preloader included with Rails will interfere with testing via the Rails console.
|
|
493
498
|
|
|
494
499
|
**Spring will not reload initializers** unless the initializer is changed. Therefore, if you're making a change to your YML schedule file and reloading Rails console to see the change, Spring will make it seem like your modified schedule is not being reloaded.
|
|
495
500
|
|
|
@@ -534,7 +539,7 @@ MIT License
|
|
|
534
539
|
|
|
535
540
|
## Copyright
|
|
536
541
|
|
|
537
|
-
- Copyright 2021 -
|
|
542
|
+
- Copyright 2021 - 2024 Marcelo Lauxen.
|
|
538
543
|
- Copyright 2013 - 2022 Moove-IT.
|
|
539
544
|
- Copyright 2012 Morton Jonuschat.
|
|
540
545
|
- Some parts copyright 2010 Ben VandenBos.
|
|
@@ -59,6 +59,17 @@ module SidekiqScheduler
|
|
|
59
59
|
SidekiqScheduler::SidekiqAdapter.sidekiq_queues(sidekiq_config)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
def to_hash
|
|
63
|
+
{
|
|
64
|
+
enabled: enabled?,
|
|
65
|
+
dynamic: dynamic?,
|
|
66
|
+
dynamic_every: dynamic_every?,
|
|
67
|
+
schedule: schedule,
|
|
68
|
+
listened_queues_only: listened_queues_only?,
|
|
69
|
+
rufus_scheduler_options: rufus_scheduler_options
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
62
73
|
private
|
|
63
74
|
|
|
64
75
|
attr_reader :scheduler_config
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
require 'sidekiq/web' unless defined?(Sidekiq::Web)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
if SidekiqScheduler::SidekiqAdapter::SIDEKIQ_GTE_7_3_0
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Sidekiq::Web.
|
|
7
|
-
|
|
5
|
+
# Locale and asset cache is configured in `.register`
|
|
6
|
+
Sidekiq::Web.register(SidekiqScheduler::Web,
|
|
7
|
+
name: "recurring_jobs",
|
|
8
|
+
tab: ["Recurring Jobs"],
|
|
9
|
+
index: ["recurring-jobs"],
|
|
10
|
+
root_dir: File.expand_path("../../../web", File.dirname(__FILE__)),
|
|
11
|
+
asset_paths: ["stylesheets-scheduler"]) do |app|
|
|
12
|
+
# add middleware or additional settings here
|
|
13
|
+
end
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
else
|
|
16
|
+
|
|
17
|
+
ASSETS_PATH = File.expand_path('../../../web/assets', __dir__)
|
|
18
|
+
|
|
19
|
+
Sidekiq::Web.register(SidekiqScheduler::Web)
|
|
20
|
+
Sidekiq::Web.tabs['recurring_jobs'] = 'recurring-jobs'
|
|
21
|
+
Sidekiq::Web.locales << File.expand_path("#{File.dirname(__FILE__)}/../../../web/locales")
|
|
22
|
+
|
|
23
|
+
Sidekiq::Web.use Rack::Static, urls: ['/recurring_jobs/stylesheets-scheduler'],
|
|
11
24
|
root: ASSETS_PATH,
|
|
12
25
|
cascade: true,
|
|
13
|
-
header_rules: [[:all, { 'cache-control' => '
|
|
26
|
+
header_rules: [[:all, { 'cache-control' => 'private, max-age=86400' }]]
|
|
14
27
|
end
|
|
@@ -38,7 +38,7 @@ module SidekiqScheduler
|
|
|
38
38
|
#
|
|
39
39
|
# @return [String] with the job's interval
|
|
40
40
|
def interval
|
|
41
|
-
@attributes['cron'] || @attributes['interval'] || @attributes['every']
|
|
41
|
+
@attributes['cron'] || @attributes['interval'] || @attributes['every'] || @attributes['at'] || @attributes['in']
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Returns the queue of the job
|
|
@@ -24,6 +24,15 @@ module SidekiqScheduler
|
|
|
24
24
|
@scheduler_instance.load_schedule!
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
# This method is needed to avoid exposing unnecessary information.
|
|
28
|
+
# Because ActiveSupport's `as_json` traverses instance values to convert the object to a hash
|
|
29
|
+
# unless it responds to `to_hash`.
|
|
30
|
+
def to_hash
|
|
31
|
+
{
|
|
32
|
+
scheduler: @scheduler_instance.to_hash
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
27
36
|
private
|
|
28
37
|
|
|
29
38
|
def set_current_scheduler_options(config)
|
|
@@ -121,7 +121,7 @@ module SidekiqScheduler
|
|
|
121
121
|
Sidekiq.redis { |r| r.del(schedules_changed_key) unless r.type(schedules_changed_key) == 'zset' }
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
#
|
|
124
|
+
# Registers a queued job instance
|
|
125
125
|
#
|
|
126
126
|
# @param [String] job_name The name of the job
|
|
127
127
|
# @param [Time] time The time at which the job was cleared by the scheduler
|
|
@@ -130,9 +130,9 @@ module SidekiqScheduler
|
|
|
130
130
|
def self.register_job_instance(job_name, time)
|
|
131
131
|
job_key = pushed_job_key(job_name)
|
|
132
132
|
registered, _ = Sidekiq.redis do |r|
|
|
133
|
-
r.
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
r.multi do |m|
|
|
134
|
+
m.zadd(job_key, time.to_i, time.to_i)
|
|
135
|
+
m.expire(job_key, REGISTERED_JOBS_THRESHOLD_IN_SECONDS)
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
|
|
@@ -65,7 +65,7 @@ module SidekiqScheduler
|
|
|
65
65
|
end
|
|
66
66
|
alias_method :schedule!, :reload_schedule!
|
|
67
67
|
|
|
68
|
-
#
|
|
68
|
+
# Retrieve the schedule configuration for the given name
|
|
69
69
|
# if the name is nil it returns a hash with all the
|
|
70
70
|
# names end their schedules.
|
|
71
71
|
def get_schedule(name = nil)
|
|
@@ -17,7 +17,7 @@ module SidekiqScheduler
|
|
|
17
17
|
# saying we will have to do it somehow still)
|
|
18
18
|
#
|
|
19
19
|
# NOTE: ^ Keeping this TODO here for now, in a future version of this project
|
|
20
|
-
# we will remove those attr
|
|
20
|
+
# we will remove those attr accessors and use only our config object. For now,
|
|
21
21
|
# let's keep as it is.
|
|
22
22
|
|
|
23
23
|
# Set to enable or disable the scheduler.
|
|
@@ -58,7 +58,7 @@ module SidekiqScheduler
|
|
|
58
58
|
self.dynamic = config.dynamic?
|
|
59
59
|
self.dynamic_every = config.dynamic_every?
|
|
60
60
|
self.listened_queues_only = config.listened_queues_only?
|
|
61
|
-
self.rufus_scheduler_options = config.rufus_scheduler_options
|
|
61
|
+
self.rufus_scheduler_options = config.rufus_scheduler_options || {}
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# the Rufus::Scheduler jobs that are scheduled
|
|
@@ -128,6 +128,8 @@ module SidekiqScheduler
|
|
|
128
128
|
schedule, options = SidekiqScheduler::RufusUtils.normalize_schedule_options(config_interval_type)
|
|
129
129
|
|
|
130
130
|
rufus_job = new_job(name, interval_type, config, schedule, options)
|
|
131
|
+
return unless rufus_job
|
|
132
|
+
|
|
131
133
|
@scheduled_jobs[name] = rufus_job
|
|
132
134
|
SidekiqScheduler::Utils.update_job_next_time(name, rufus_job.next_time)
|
|
133
135
|
|
|
@@ -194,7 +196,7 @@ module SidekiqScheduler
|
|
|
194
196
|
@rufus_scheduler = nil
|
|
195
197
|
end
|
|
196
198
|
|
|
197
|
-
|
|
199
|
+
@scheduled_jobs = {}
|
|
198
200
|
|
|
199
201
|
rufus_scheduler
|
|
200
202
|
end
|
|
@@ -248,6 +250,12 @@ module SidekiqScheduler
|
|
|
248
250
|
end
|
|
249
251
|
end
|
|
250
252
|
|
|
253
|
+
def to_hash
|
|
254
|
+
{
|
|
255
|
+
scheduler_config: @scheduler_config.to_hash
|
|
256
|
+
}
|
|
257
|
+
end
|
|
258
|
+
|
|
251
259
|
private
|
|
252
260
|
|
|
253
261
|
attr_reader :scheduler_config
|
|
@@ -256,7 +264,15 @@ module SidekiqScheduler
|
|
|
256
264
|
options = options.merge({ :job => true, :tags => [name] })
|
|
257
265
|
|
|
258
266
|
rufus_scheduler.send(interval_type, schedule, options) do |job, time|
|
|
259
|
-
|
|
267
|
+
if job_enabled?(name)
|
|
268
|
+
conf = SidekiqScheduler::Utils.sanitize_job_config(config)
|
|
269
|
+
|
|
270
|
+
if job.is_a?(Rufus::Scheduler::CronJob)
|
|
271
|
+
idempotent_job_enqueue(name, SidekiqScheduler::Utils.calc_cron_run_time(job.cron_line, time.to_t), conf)
|
|
272
|
+
else
|
|
273
|
+
idempotent_job_enqueue(name, time.to_t, conf)
|
|
274
|
+
end
|
|
275
|
+
end
|
|
260
276
|
end
|
|
261
277
|
end
|
|
262
278
|
|
|
@@ -287,12 +303,12 @@ module SidekiqScheduler
|
|
|
287
303
|
end
|
|
288
304
|
|
|
289
305
|
# Adds a Hash with schedule metadata as the last argument to call the worker.
|
|
290
|
-
# It currently returns the schedule time as a Float number representing the
|
|
306
|
+
# It currently returns the schedule time as a Float number representing the milliseconds
|
|
291
307
|
# since epoch.
|
|
292
308
|
#
|
|
293
309
|
# @example with hash argument
|
|
294
310
|
# arguments_with_metadata({value: 1}, scheduled_at: Time.now.round(3))
|
|
295
|
-
# #=> [{value: 1}, {scheduled_at: <
|
|
311
|
+
# #=> [{value: 1}, {scheduled_at: <milliseconds since epoch>}]
|
|
296
312
|
#
|
|
297
313
|
# @param args [Array|Hash]
|
|
298
314
|
# @param metadata [Hash]
|
|
@@ -4,6 +4,7 @@ module SidekiqScheduler
|
|
|
4
4
|
class SidekiqAdapter
|
|
5
5
|
SIDEKIQ_GTE_6_5_0 = Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('6.5.0')
|
|
6
6
|
SIDEKIQ_GTE_7_0_0 = Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.0.0')
|
|
7
|
+
SIDEKIQ_GTE_7_3_0 = Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.3.0')
|
|
7
8
|
|
|
8
9
|
def self.fetch_scheduler_config_from_sidekiq(sidekiq_config)
|
|
9
10
|
return {} if sidekiq_config.nil?
|
|
@@ -73,7 +73,7 @@ module SidekiqScheduler
|
|
|
73
73
|
# Returns true if the enqueuing needs to be done for an ActiveJob
|
|
74
74
|
# class false otherwise.
|
|
75
75
|
#
|
|
76
|
-
# @param [Class] klass the class to check is
|
|
76
|
+
# @param [Class] klass the class to check is descendant from ActiveJob
|
|
77
77
|
#
|
|
78
78
|
# @return [Boolean]
|
|
79
79
|
def self.active_job_enqueue?(klass)
|
|
@@ -141,5 +141,41 @@ module SidekiqScheduler
|
|
|
141
141
|
def self.update_job_last_time(name, last_time)
|
|
142
142
|
SidekiqScheduler::RedisManager.set_job_last_time(name, last_time) if last_time
|
|
143
143
|
end
|
|
144
|
+
|
|
145
|
+
# Try to figure out when the cron job was supposed to run.
|
|
146
|
+
#
|
|
147
|
+
# Rufus calls the scheduler block with the current time and not the time the block was scheduled to run.
|
|
148
|
+
# This means under certain conditions you could have a job get scheduled multiple times because `time.to_i` is used
|
|
149
|
+
# to key the job in redis. If one server is under load and Rufus tries to run the jobs 1 seconds after the other
|
|
150
|
+
# server then the job will be queued twice.
|
|
151
|
+
# This method essentially makes a best guess at when this job was supposed to run and return that.
|
|
152
|
+
#
|
|
153
|
+
# @param [Fugit::Cron] cron
|
|
154
|
+
# @param [Time] time
|
|
155
|
+
#
|
|
156
|
+
# @return [Time]
|
|
157
|
+
def self.calc_cron_run_time(cron, time)
|
|
158
|
+
time = time.floor # remove sub seconds to prevent rounding errors.
|
|
159
|
+
return time if cron.match?(time) # If the time is a perfect match then return it.
|
|
160
|
+
|
|
161
|
+
next_t = cron.next_time(time).to_t
|
|
162
|
+
previous_t = cron.previous_time(time).to_t
|
|
163
|
+
# The `time` var is some point between `previous_t` and `next_t`.
|
|
164
|
+
# Figure out how far off we are from each side in seconds.
|
|
165
|
+
next_diff = next_t - time
|
|
166
|
+
previous_diff = time - previous_t
|
|
167
|
+
|
|
168
|
+
if next_diff == previous_diff
|
|
169
|
+
# In the event `time` is exactly between `previous_t` and `next_t` the diff will not be equal to
|
|
170
|
+
# `cron.rough_frequency`. In that case we round down.
|
|
171
|
+
cron.rough_frequency == next_diff ? time : previous_t
|
|
172
|
+
elsif next_diff > previous_diff
|
|
173
|
+
# We are closer to the previous run time so return that.
|
|
174
|
+
previous_t
|
|
175
|
+
else
|
|
176
|
+
# We are closer to the next run time so return that.
|
|
177
|
+
next_t
|
|
178
|
+
end
|
|
179
|
+
end
|
|
144
180
|
end
|
|
145
181
|
end
|
data/web/locales/cs.yml
CHANGED
data/web/locales/de.yml
CHANGED
data/web/locales/en.yml
CHANGED
data/web/locales/es.yml
CHANGED
data/web/locales/fr.yml
CHANGED
data/web/locales/gd.yml
CHANGED
data/web/locales/it.yml
CHANGED
data/web/locales/ja.yml
CHANGED
data/web/locales/nl.yml
CHANGED
data/web/locales/pl.yml
CHANGED
data/web/locales/pt-BR.yml
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
pt-BR:
|
|
2
|
+
"Recurring Jobs": Jobs Recorrentes
|
|
2
3
|
recurring_jobs: Jobs Recorrentes
|
|
3
4
|
name: Nome
|
|
4
5
|
description: Descrição
|
|
@@ -6,7 +7,7 @@ pt-BR:
|
|
|
6
7
|
class: Classe
|
|
7
8
|
queue: Fila
|
|
8
9
|
arguments: Argumentos
|
|
9
|
-
enqueue_now: Enfileirar agora
|
|
10
|
+
enqueue_now: Enfileirar agora
|
|
10
11
|
last_time: Última execução
|
|
11
12
|
next_time: Próxima execução
|
|
12
13
|
no_next_time: Não há mais execuçoẽs
|
data/web/locales/ru.yml
CHANGED
data/web/locales/sv.yml
CHANGED
data/web/locales/zh-cn.yml
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
<% if
|
|
2
|
-
|
|
1
|
+
<% if SidekiqScheduler::SidekiqAdapter::SIDEKIQ_GTE_7_3_0 %>
|
|
2
|
+
<%= style_tag "recurring_jobs/stylesheets-scheduler/recurring_jobs.css" %>
|
|
3
3
|
<% else %>
|
|
4
|
-
|
|
5
|
-
.recurring-jobs { border-top-left-radius: 4px; border-top-right-radius: 4px; }
|
|
6
|
-
.recurring-jobs .title { margin-bottom: 5px; }
|
|
7
|
-
.recurring-jobs .title .name { font-weight: bold;}
|
|
8
|
-
.recurring-jobs .info,
|
|
9
|
-
.recurring-jobs .description { margin-bottom: 5px; }
|
|
10
|
-
.recurring-jobs .actions { margin-bottom: 5px; }
|
|
11
|
-
.recurring-jobs .status,
|
|
12
|
-
.recurring-jobs .description { font-size: 12px; }
|
|
13
|
-
.recurring-jobs .enqueue { margin-bottom: 0.5rem }
|
|
14
|
-
|
|
15
|
-
.list-group-item {
|
|
16
|
-
background-color: #f3f3f3;
|
|
17
|
-
color: #585454;
|
|
18
|
-
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.list-group-item-disabled {
|
|
22
|
-
background-color: #f3d3d3;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.toggle-all-buttons {
|
|
26
|
-
margin-top: 20px;
|
|
27
|
-
margin-bottom: 10px;
|
|
28
|
-
line-height: 45px;
|
|
29
|
-
text-align: right;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@media (max-width: 768px) {
|
|
33
|
-
.toggle-all-buttons {
|
|
34
|
-
margin-top: 0;
|
|
35
|
-
text-align: left;
|
|
36
|
-
line-height: inherit;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
</style>
|
|
4
|
+
<link href="<%= root_path %>recurring_jobs/stylesheets-scheduler/recurring_jobs.css" media="screen" rel="stylesheet" type="text/css" />
|
|
40
5
|
<% end %>
|
|
41
6
|
|
|
42
7
|
<div class="row">
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sidekiq-scheduler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0.
|
|
4
|
+
version: 5.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Morton Jonuschat
|
|
8
8
|
- Moove-it
|
|
9
9
|
- Marcelo Lauxen
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2024-08-01 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: sidekiq
|
|
@@ -53,6 +53,9 @@ dependencies:
|
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: 1.4.0
|
|
56
|
+
- - "<"
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '3'
|
|
56
59
|
type: :runtime
|
|
57
60
|
prerelease: false
|
|
58
61
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -60,6 +63,9 @@ dependencies:
|
|
|
60
63
|
- - ">="
|
|
61
64
|
- !ruby/object:Gem::Version
|
|
62
65
|
version: 1.4.0
|
|
66
|
+
- - "<"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3'
|
|
63
69
|
- !ruby/object:Gem::Dependency
|
|
64
70
|
name: rake
|
|
65
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -214,7 +220,7 @@ files:
|
|
|
214
220
|
- lib/sidekiq-scheduler/version.rb
|
|
215
221
|
- lib/sidekiq-scheduler/web.rb
|
|
216
222
|
- lib/sidekiq/scheduler.rb
|
|
217
|
-
- web/assets/stylesheets-scheduler/recurring_jobs.css
|
|
223
|
+
- web/assets/recurring_jobs/stylesheets-scheduler/recurring_jobs.css
|
|
218
224
|
- web/locales/cs.yml
|
|
219
225
|
- web/locales/de.yml
|
|
220
226
|
- web/locales/en.yml
|
|
@@ -233,8 +239,9 @@ files:
|
|
|
233
239
|
homepage: https://sidekiq-scheduler.github.io/sidekiq-scheduler/
|
|
234
240
|
licenses:
|
|
235
241
|
- MIT
|
|
236
|
-
metadata:
|
|
237
|
-
|
|
242
|
+
metadata:
|
|
243
|
+
rubygems_mfa_required: 'true'
|
|
244
|
+
post_install_message:
|
|
238
245
|
rdoc_options: []
|
|
239
246
|
require_paths:
|
|
240
247
|
- lib
|
|
@@ -249,8 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
249
256
|
- !ruby/object:Gem::Version
|
|
250
257
|
version: '0'
|
|
251
258
|
requirements: []
|
|
252
|
-
rubygems_version: 3.
|
|
253
|
-
signing_key:
|
|
259
|
+
rubygems_version: 3.5.3
|
|
260
|
+
signing_key:
|
|
254
261
|
specification_version: 4
|
|
255
262
|
summary: Light weight job scheduling extension for Sidekiq
|
|
256
263
|
test_files: []
|
/data/web/assets/{stylesheets-scheduler → recurring_jobs/stylesheets-scheduler}/recurring_jobs.css
RENAMED
|
File without changes
|