sidekiq-scheduler 3.1.1 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aff61224563645891063110d5f9ae5d16e6ccb0fee92df6a5f26976d0169c01b
4
- data.tar.gz: d8a6ac2c6e17426bc095904ac3721a9433a21cfd1be433e5f280b9af5469954a
3
+ metadata.gz: 0f30ce85a9aba1cfa5987dbbd3ec24715b4d6adeadd3e36079be8425d0d673b7
4
+ data.tar.gz: 92b27fba4b1405a4466ff180ebd60fc981e07cbc15d2497a63af9ae8d1c2ab2b
5
5
  SHA512:
6
- metadata.gz: b01ea69bb3bafd959681e3f7cb3a5699385bdf73bf8abeb8e75a6e2765ec1476862f1d499046ae00233539ec266d313c55c03558961fab8f02b048e4164778bd
7
- data.tar.gz: 7662c439f79b05f2954cfc0e1da2d0a84236334f75101431ed187ae8c69df47baa52cbee901e90a84e81b7ed5b7f81198938ca09cf3710f5885866b334cfcb43
6
+ metadata.gz: 211ec1b0efa783fec645f9afb598225456a9d2e61a17318e95eb9c3eec71cfb061606829667e51e49badb9b23aca46d905e500eda4d09704af959749eba5b651
7
+ data.tar.gz: d832b58c8b2526774dd7b54ec7295c89da87b000b105cca465631c628941a7b21e9f864f29c2360d2203f7463412d0c7eab2ee2b7d69f566598a46f56ca94428
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # 3.2.1
2
+ - Fix CSS not loading on Rails app when Sidekiq < 6 https://github.com/moove-it/sidekiq-scheduler/pull/377
3
+ # 3.2.0
4
+
5
+ - Fix deprecated uses of Redis#pipelined https://github.com/moove-it/sidekiq-scheduler/pull/357
6
+ - Prevent sidekiq_options from overriding ActiveJob queue settings https://github.com/moove-it/sidekiq-scheduler/pull/367
7
+ - 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
- Sidekiq::Web.use Rack::Static, urls: ['/stylesheets'],
9
- root: ASSETS_PATH,
10
- cascade: true,
11
- header_rules: [[:all, { 'Cache-Control' => 'public, max-age=86400' }]]
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
@@ -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
- r.zadd(job_key, time.to_i, time.to_i)
142
- r.expire(job_key, REGISTERED_JOBS_THRESHOLD_IN_SECONDS)
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
- if klass.respond_to?(:sidekiq_options)
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
@@ -161,7 +161,7 @@ module SidekiqScheduler
161
161
  config['args'] = arguments_with_metadata(config['args'], scheduled_at: time.to_f)
162
162
  end
163
163
 
164
- if active_job_enqueue?(config['class'])
164
+ if SidekiqScheduler::Utils.active_job_enqueue?(config['class'])
165
165
  SidekiqScheduler::Utils.enqueue_with_active_job(config)
166
166
  else
167
167
  SidekiqScheduler::Utils.enqueue_with_sidekiq(config)
@@ -307,17 +307,6 @@ module SidekiqScheduler
307
307
  queues.empty? || queues.include?(job_queue)
308
308
  end
309
309
 
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
310
  # Convert the given arguments in the format expected to be enqueued.
322
311
  #
323
312
  # @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,5 +1,5 @@
1
1
  module SidekiqScheduler
2
2
 
3
- VERSION = '3.1.1'
3
+ VERSION = '3.2.1'
4
4
 
5
5
  end
@@ -14,6 +14,10 @@
14
14
  border: 1px solid rgba(0, 0, 0, 0.1);
15
15
  }
16
16
 
17
+ .list-group-item-disabled {
18
+ background-color: #f3d3d3;
19
+ }
20
+
17
21
  @media (prefers-color-scheme: dark) {
18
22
  .list-group-item {
19
23
  background-color: #222;
@@ -1,11 +1,35 @@
1
- <link href="<%= root_path %>stylesheets/recurring_jobs.css" media="screen" rel="stylesheet" type="text/css" />
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.1.1
4
+ version: 3.2.1
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-01-26 00:00:00.000000000 Z
12
+ date: 2022-04-27 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