sidekiq-scheduler 3.1.1 → 3.2.0

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: b8bddb1a9c6aeffceb3a1efde76cc88285a5a4ef2ea1e7e1ef85ac35b4e311f4
4
+ data.tar.gz: b88000d6771e9a5d88754dd753bf96dc142453ff170bf2fd11bbe1afc50de3fd
5
5
  SHA512:
6
- metadata.gz: b01ea69bb3bafd959681e3f7cb3a5699385bdf73bf8abeb8e75a6e2765ec1476862f1d499046ae00233539ec266d313c55c03558961fab8f02b048e4164778bd
7
- data.tar.gz: 7662c439f79b05f2954cfc0e1da2d0a84236334f75101431ed187ae8c69df47baa52cbee901e90a84e81b7ed5b7f81198938ca09cf3710f5885866b334cfcb43
6
+ metadata.gz: 444aa2319dfe4a4817348ed7cd8d92d3f11ca16ed04ac9b8c4b590c68d2c86ef7df27cab0a81d0c78c0a26000cdaaa332870d0ec644a59241d96c34ddc80b5e0
7
+ data.tar.gz: 32ecf78f608fbec6a2b017a88d1bd332f4af20931d55751ea44499af77a2df664ff71a57a3bce55dac2c8ded981fc960b96b67eb3076f7ab7c7d3b59baa77fc5
@@ -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.0'
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;
@@ -5,7 +5,7 @@
5
5
  <div class="recurring-jobs">
6
6
  <ul class="list-group">
7
7
  <% @presented_jobs.each do |job| %>
8
- <li class="list-group-item">
8
+ <li class="list-group-item <%= !job.enabled? && "list-group-item-disabled" %>">
9
9
  <div class="title">
10
10
  <div class="row">
11
11
  <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.0
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-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq