sidekiq-scheduler 3.1.1 → 3.2.2
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 +11 -0
- data/lib/sidekiq-scheduler/extensions/web.rb +7 -4
- data/lib/sidekiq-scheduler/manager.rb +0 -4
- data/lib/sidekiq-scheduler/redis_manager.rb +3 -3
- data/lib/sidekiq-scheduler/schedule.rb +3 -1
- data/lib/sidekiq-scheduler/scheduler.rb +1 -15
- data/lib/sidekiq-scheduler/utils.rb +11 -0
- data/lib/sidekiq-scheduler/version.rb +1 -3
- data/web/assets/stylesheets/recurring_jobs.css +4 -0
- data/web/views/recurring_jobs.erb +26 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7d47069eda4c979115cb594aa870a55546a7fe1b895053fb2df69b0962163eb
|
|
4
|
+
data.tar.gz: e966ab0f5aa48ec3fef2adfe4327e8b72b38f1c4f8da593052e9227e3396b69c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f45636415dac48c0882d75449475d10de07beb6d1f1bfe2873d71f0264f65f2cb58a7a5dd42ff5bd784d79f46f2bd4f00ceb2d27bae47fcc80796b5dbcd22be8
|
|
7
|
+
data.tar.gz: e338d8ff6767dbe7ea21a22fd23d702d49b7095a64be296843d97dcaa415b9c73867edd0601dd4839ccce91bdf271aabaa458d9954b6cb2e42273dd460428383
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 3.2.2
|
|
2
|
+
|
|
3
|
+
- [FIX] Add support for sidekiq 6.5 #382
|
|
4
|
+
|
|
5
|
+
# 3.2.1
|
|
6
|
+
- Fix CSS not loading on Rails app when Sidekiq < 6 https://github.com/moove-it/sidekiq-scheduler/pull/377
|
|
7
|
+
# 3.2.0
|
|
8
|
+
|
|
9
|
+
- Fix deprecated uses of Redis#pipelined https://github.com/moove-it/sidekiq-scheduler/pull/357
|
|
10
|
+
- Prevent sidekiq_options from overriding ActiveJob queue settings https://github.com/moove-it/sidekiq-scheduler/pull/367
|
|
11
|
+
- Highlight disabled jobs https://github.com/moove-it/sidekiq-scheduler/pull/369
|
|
@@ -5,7 +5,10 @@ ASSETS_PATH = File.expand_path('../../../web/assets', __dir__)
|
|
|
5
5
|
Sidekiq::Web.register(SidekiqScheduler::Web)
|
|
6
6
|
Sidekiq::Web.tabs['recurring_jobs'] = 'recurring-jobs'
|
|
7
7
|
Sidekiq::Web.locales << File.expand_path("#{File.dirname(__FILE__)}/../../../web/locales")
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
|
|
9
|
+
if Sidekiq::VERSION >= '6.0.0'
|
|
10
|
+
Sidekiq::Web.use Rack::Static, urls: ['/stylesheets'],
|
|
11
|
+
root: ASSETS_PATH,
|
|
12
|
+
cascade: true,
|
|
13
|
+
header_rules: [[:all, { 'Cache-Control' => 'public, max-age=86400' }]]
|
|
14
|
+
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
require 'redis'
|
|
2
2
|
|
|
3
|
-
require 'sidekiq/util'
|
|
4
|
-
|
|
5
3
|
require 'sidekiq-scheduler/schedule'
|
|
6
4
|
require 'sidekiq-scheduler/scheduler'
|
|
7
5
|
|
|
@@ -12,8 +10,6 @@ module SidekiqScheduler
|
|
|
12
10
|
# from Redis onto the work queues
|
|
13
11
|
#
|
|
14
12
|
class Manager
|
|
15
|
-
include Sidekiq::Util
|
|
16
|
-
|
|
17
13
|
DEFAULT_SCHEDULER_OPTIONS = {
|
|
18
14
|
enabled: true,
|
|
19
15
|
dynamic: false,
|
|
@@ -137,9 +137,9 @@ module SidekiqScheduler
|
|
|
137
137
|
def self.register_job_instance(job_name, time)
|
|
138
138
|
job_key = pushed_job_key(job_name)
|
|
139
139
|
registered, _ = Sidekiq.redis do |r|
|
|
140
|
-
r.pipelined do
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
r.pipelined do |pipeline|
|
|
141
|
+
pipeline.zadd(job_key, time.to_i, time.to_i)
|
|
142
|
+
pipeline.expire(job_key, REGISTERED_JOBS_THRESHOLD_IN_SECONDS)
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
|
|
@@ -140,7 +140,9 @@ module SidekiqScheduler
|
|
|
140
140
|
def infer_queue(klass)
|
|
141
141
|
klass = try_to_constantize(klass)
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
# ActiveJob uses queue_as when the job is created
|
|
144
|
+
# to determine the queue
|
|
145
|
+
if klass.respond_to?(:sidekiq_options) && !SidekiqScheduler::Utils.active_job_enqueue?(klass)
|
|
144
146
|
klass.sidekiq_options['queue']
|
|
145
147
|
end
|
|
146
148
|
end
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
require 'rufus/scheduler'
|
|
2
2
|
require 'thwait'
|
|
3
|
-
require 'sidekiq/util'
|
|
4
3
|
require 'json'
|
|
5
4
|
require 'sidekiq-scheduler/rufus_utils'
|
|
6
5
|
require 'sidekiq-scheduler/redis_manager'
|
|
7
6
|
|
|
8
7
|
module SidekiqScheduler
|
|
9
8
|
class Scheduler
|
|
10
|
-
extend Sidekiq::Util
|
|
11
|
-
|
|
12
9
|
# We expect rufus jobs to have #params
|
|
13
10
|
Rufus::Scheduler::Job.module_eval do
|
|
14
11
|
alias_method :params, :opts
|
|
@@ -161,7 +158,7 @@ module SidekiqScheduler
|
|
|
161
158
|
config['args'] = arguments_with_metadata(config['args'], scheduled_at: time.to_f)
|
|
162
159
|
end
|
|
163
160
|
|
|
164
|
-
if active_job_enqueue?(config['class'])
|
|
161
|
+
if SidekiqScheduler::Utils.active_job_enqueue?(config['class'])
|
|
165
162
|
SidekiqScheduler::Utils.enqueue_with_active_job(config)
|
|
166
163
|
else
|
|
167
164
|
SidekiqScheduler::Utils.enqueue_with_sidekiq(config)
|
|
@@ -307,17 +304,6 @@ module SidekiqScheduler
|
|
|
307
304
|
queues.empty? || queues.include?(job_queue)
|
|
308
305
|
end
|
|
309
306
|
|
|
310
|
-
# Returns true if the enqueuing needs to be done for an ActiveJob
|
|
311
|
-
# class false otherwise.
|
|
312
|
-
#
|
|
313
|
-
# @param [Class] klass the class to check is decendant from ActiveJob
|
|
314
|
-
#
|
|
315
|
-
# @return [Boolean]
|
|
316
|
-
def active_job_enqueue?(klass)
|
|
317
|
-
klass.is_a?(Class) && defined?(ActiveJob::Enqueuing) &&
|
|
318
|
-
klass.included_modules.include?(ActiveJob::Enqueuing)
|
|
319
|
-
end
|
|
320
|
-
|
|
321
307
|
# Convert the given arguments in the format expected to be enqueued.
|
|
322
308
|
#
|
|
323
309
|
# @param [Hash] config the options to be converted
|
|
@@ -68,6 +68,17 @@ module SidekiqScheduler
|
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
# Returns true if the enqueuing needs to be done for an ActiveJob
|
|
72
|
+
# class false otherwise.
|
|
73
|
+
#
|
|
74
|
+
# @param [Class] klass the class to check is decendant from ActiveJob
|
|
75
|
+
#
|
|
76
|
+
# @return [Boolean]
|
|
77
|
+
def self.active_job_enqueue?(klass)
|
|
78
|
+
klass.is_a?(Class) && defined?(ActiveJob::Enqueuing) &&
|
|
79
|
+
klass.included_modules.include?(ActiveJob::Enqueuing)
|
|
80
|
+
end
|
|
81
|
+
|
|
71
82
|
# Enqueues the job using the Sidekiq client.
|
|
72
83
|
#
|
|
73
84
|
# @param [Hash] config The job configuration
|
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
<% if Sidekiq::VERSION >= '6.0.0' %>
|
|
2
|
+
<link href="<%= root_path %>stylesheets/recurring_jobs.css" media="screen" rel="stylesheet" type="text/css" />
|
|
3
|
+
<% else %>
|
|
4
|
+
<style>
|
|
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
|
+
</style>
|
|
25
|
+
<% end %>
|
|
2
26
|
|
|
3
27
|
<h3><%= t('recurring_jobs') %></h3>
|
|
4
28
|
|
|
5
29
|
<div class="recurring-jobs">
|
|
6
30
|
<ul class="list-group">
|
|
7
31
|
<% @presented_jobs.each do |job| %>
|
|
8
|
-
<li class="list-group-item">
|
|
32
|
+
<li class="list-group-item <%= !job.enabled? && "list-group-item-disabled" %>">
|
|
9
33
|
<div class="title">
|
|
10
34
|
<div class="row">
|
|
11
35
|
<div class="col-xs-6">
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sidekiq-scheduler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Morton Jonuschat
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2022-
|
|
12
|
+
date: 2022-06-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: sidekiq
|
|
@@ -263,6 +263,7 @@ executables: []
|
|
|
263
263
|
extensions: []
|
|
264
264
|
extra_rdoc_files: []
|
|
265
265
|
files:
|
|
266
|
+
- CHANGELOG.md
|
|
266
267
|
- MIT-LICENSE
|
|
267
268
|
- README.md
|
|
268
269
|
- Rakefile
|