sidekiq-scheduler 5.0.5 → 5.0.6

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: 37443909d89f84370b1f475426c6b21564f1e1f97df5e70018f8791eb4a215bb
4
- data.tar.gz: 04e0ca34182e9ef7234422d27d3e940f80d6ce1daffe60ae75bb0d244cdd83c2
3
+ metadata.gz: a2d6cf0887d66e27d2ce10ec96eabcb2b89bd89c515af8e38d54b366b38a8df2
4
+ data.tar.gz: c0da1db9ad45afdaf3b6055ce22ccc24ac90a392f7a2b5787136bbdeb6456fd5
5
5
  SHA512:
6
- metadata.gz: 3fdd135d83f6ae7c423d9284ea4a8bfb457b8ca08285abaea604a729b824f392c2c370b618c0a84dad6f9dd86fe301a9f59b742e08447f82ecc29d322750929a
7
- data.tar.gz: 3bfc766d6011f10d142da7785c22852c0df8a3df88dc5849494b9a25f711a02af224bb8ae6317721572381b75d170933e0680638760995241e3064f0820462bf
6
+ metadata.gz: 7d845a756d2ba958cfedadcf52f6ba6f19811eb5b88c94fc50989b6a6f2bf523dbc7d2f8eb8e44c9d0c20a483f5896e5c313e5428f2369368de12479a2472163
7
+ data.tar.gz: 797ebac76066faa408f2f43290f6aead6a4ff335cb966811efdeea5c70c7ca5a4f93e6bda15f864987294e505583999bff64d05f33f2f2b9d0c92f512487d905
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
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
+
1
6
  # 5.0.5
2
7
  - [**FIX**] Use correct folder structure for assets [#476](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/476)
3
8
 
@@ -38,7 +43,7 @@
38
43
 
39
44
  # 5.0.0
40
45
 
41
- - [**FIX**] Ensure generated scheduled time has a precision of 3 miliseconds. [#418](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/418)
46
+ - [**FIX**] Ensure generated scheduled time has a precision of 3 milliseconds. [#418](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/418)
42
47
 
43
48
  *Note 1:* Check [# 5.0.0.beta1](#500beta1) & [# 5.0.0.beta2](#500beta2) releases for breaking changes.
44
49
 
@@ -91,6 +96,6 @@
91
96
  - [**ENHANCEMENT**] Highlight disabled jobs [#369](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/369)
92
97
  - [**BREAKING CHANGE**] Require redis 4.2.0 [#370](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/370)
93
98
  - [**FIX**] Fixes redis deprecation warning regarding `exists` [#370](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/370)
94
- - [**BREAKING CHANGE**] Remove dependecy on thwait and e2mmap [#371](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/371)
99
+ - [**BREAKING CHANGE**] Remove dependency on thwait and e2mmap [#371](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/371)
95
100
  - Support Ruby 3.1 [#373](https://github.com/sidekiq-scheduler/sidekiq-scheduler/pull/373)
96
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
@@ -337,7 +337,7 @@ You can also override the thread pool size in Rufus Scheduler by setting the fol
337
337
  ## Notes about running on Multiple Hosts
338
338
 
339
339
  Under normal conditions, `cron` and `at` jobs are pushed once regardless of the number of `sidekiq-scheduler` running instances,
340
- assumming that time deltas between hosts is less than 24 hours.
340
+ assuming that time deltas between hosts is less than 24 hours.
341
341
 
342
342
  Non-normal conditions that could push a specific job multiple times are:
343
343
  - high cpu load + a high number of jobs scheduled at the same time, like 100 jobs
@@ -494,7 +494,7 @@ end
494
494
 
495
495
  ## The Spring preloader and Testing your initializer via Rails console
496
496
 
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 interefere with testing via the Rails console.
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.
498
498
 
499
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.
500
500
 
@@ -539,7 +539,7 @@ MIT License
539
539
 
540
540
  ## Copyright
541
541
 
542
- - Copyright 2021 - 2023 Marcelo Lauxen.
542
+ - Copyright 2021 - 2024 Marcelo Lauxen.
543
543
  - Copyright 2013 - 2022 Moove-IT.
544
544
  - Copyright 2012 Morton Jonuschat.
545
545
  - Some parts copyright 2010 Ben VandenBos.
@@ -64,7 +64,7 @@ module SidekiqScheduler
64
64
  enabled: enabled?,
65
65
  dynamic: dynamic?,
66
66
  dynamic_every: dynamic_every?,
67
- shedule: schedule,
67
+ schedule: schedule,
68
68
  listened_queues_only: listened_queues_only?,
69
69
  rufus_scheduler_options: rufus_scheduler_options
70
70
  }
@@ -2,7 +2,7 @@ require 'sidekiq/web' unless defined?(Sidekiq::Web)
2
2
 
3
3
  if SidekiqScheduler::SidekiqAdapter::SIDEKIQ_GTE_7_3_0
4
4
 
5
- # Locale and asset cache is configured in `.regiester`
5
+ # Locale and asset cache is configured in `.register`
6
6
  Sidekiq::Web.register(SidekiqScheduler::Web,
7
7
  name: "recurring_jobs",
8
8
  tab: ["Recurring Jobs"],
@@ -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
- # Removes a queued job instance
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
@@ -65,7 +65,7 @@ module SidekiqScheduler
65
65
  end
66
66
  alias_method :schedule!, :reload_schedule!
67
67
 
68
- # Retrive the schedule configuration for the given name
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 acessors and use only our config object. For now,
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.
@@ -196,7 +196,7 @@ module SidekiqScheduler
196
196
  @rufus_scheduler = nil
197
197
  end
198
198
 
199
- @@scheduled_jobs = {}
199
+ @scheduled_jobs = {}
200
200
 
201
201
  rufus_scheduler
202
202
  end
@@ -268,9 +268,9 @@ module SidekiqScheduler
268
268
  conf = SidekiqScheduler::Utils.sanitize_job_config(config)
269
269
 
270
270
  if job.is_a?(Rufus::Scheduler::CronJob)
271
- idempotent_job_enqueue(name, SidekiqScheduler::Utils.calc_cron_run_time(job.cron_line, time.utc), conf)
271
+ idempotent_job_enqueue(name, SidekiqScheduler::Utils.calc_cron_run_time(job.cron_line, time.to_t), conf)
272
272
  else
273
- idempotent_job_enqueue(name, time, conf)
273
+ idempotent_job_enqueue(name, time.to_t, conf)
274
274
  end
275
275
  end
276
276
  end
@@ -303,12 +303,12 @@ module SidekiqScheduler
303
303
  end
304
304
 
305
305
  # Adds a Hash with schedule metadata as the last argument to call the worker.
306
- # It currently returns the schedule time as a Float number representing the milisencods
306
+ # It currently returns the schedule time as a Float number representing the milliseconds
307
307
  # since epoch.
308
308
  #
309
309
  # @example with hash argument
310
310
  # arguments_with_metadata({value: 1}, scheduled_at: Time.now.round(3))
311
- # #=> [{value: 1}, {scheduled_at: <miliseconds since epoch>}]
311
+ # #=> [{value: 1}, {scheduled_at: <milliseconds since epoch>}]
312
312
  #
313
313
  # @param args [Array|Hash]
314
314
  # @param metadata [Hash]
@@ -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 decendant from ActiveJob
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)
@@ -155,9 +155,11 @@ module SidekiqScheduler
155
155
  #
156
156
  # @return [Time]
157
157
  def self.calc_cron_run_time(cron, time)
158
- time = time.round # remove sub seconds to prevent rounding errors.
159
- next_t = cron.next_time(time).utc
160
- previous_t = cron.previous_time(time).utc
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
161
163
  # The `time` var is some point between `previous_t` and `next_t`.
162
164
  # Figure out how far off we are from each side in seconds.
163
165
  next_diff = next_t - time
@@ -1,3 +1,3 @@
1
1
  module SidekiqScheduler
2
- VERSION = "5.0.5"
2
+ VERSION = "5.0.6"
3
3
  end
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: 5.0.5
4
+ version: 5.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morton Jonuschat
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-07-04 00:00:00.000000000 Z
13
+ date: 2024-08-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sidekiq
@@ -239,7 +239,8 @@ files:
239
239
  homepage: https://sidekiq-scheduler.github.io/sidekiq-scheduler/
240
240
  licenses:
241
241
  - MIT
242
- metadata: {}
242
+ metadata:
243
+ rubygems_mfa_required: 'true'
243
244
  post_install_message:
244
245
  rdoc_options: []
245
246
  require_paths: