simple_scheduler 1.1.0 → 1.1.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
- SHA1:
3
- metadata.gz: 2216e4b3a7b296545fc87bf4ec4509c6e54cf80c
4
- data.tar.gz: 3f7b99ddda05bbf8d97d320351e6bed5a617dea9
2
+ SHA256:
3
+ metadata.gz: f142ecc49b508ef2a79c390117fb6afb09834ac478ee7cd59fad7f48cf4bdd90
4
+ data.tar.gz: be59002f28130c9841b4f96c3fa5c79654e035b4e3ee29b7da7d208836b6d86f
5
5
  SHA512:
6
- metadata.gz: 3ea3d1b9fb643828f411b3b260e4684188d3115ea65a2f409720b4fc199092645d86fd4ac841043c2d6c2375cbf17d2dd3c1e62eb677144715a9adb0a32113a5
7
- data.tar.gz: 2b02cd203eb5bf2f16a6e469bc2cbab794445840bd95c6ce4af666a87628644a1c557f1d5bb9649ce55ca0aece0fe43837b1c886d8002a321dc5ff8ca339e249
6
+ metadata.gz: 4eca24d40adfc372df948beacf0d390116fd8961b1e5d9dae36415da4f7035574b9e61b847cf2c890f43dfe6ef2c8fd55171a81daf7b08aa9fb5fa972fa73116
7
+ data.tar.gz: 26d1cc5f13e130ad71871ccc470adbeb6a8abd7c12379cf3a5b9cf1175eaeaa52e998eab1a9384808d6693732f61c34f262b9963d148a4846f68889efd40655b
@@ -29,7 +29,8 @@ module SimpleScheduler
29
29
  def queue_future_jobs
30
30
  tasks.each do |task|
31
31
  # Schedule the new run times using the future job wrapper.
32
- task.future_run_times.each do |time|
32
+ new_run_times = task.future_run_times - task.existing_run_times
33
+ new_run_times.each do |time|
33
34
  SimpleScheduler::FutureJob.set(queue: @queue_name, wait_until: time)
34
35
  .perform_later(task.params, time.to_i)
35
36
  end
@@ -65,17 +65,17 @@ module SimpleScheduler
65
65
  # @return [Array<Time>]
66
66
  # rubocop:disable Metrics/AbcSize
67
67
  def future_run_times
68
- last_run_time = at - frequency
68
+ future_run_times = existing_run_times.dup
69
+ last_run_time = future_run_times.last || at - frequency
69
70
  last_run_time = last_run_time.in_time_zone(time_zone)
70
- future_run_times = []
71
71
 
72
72
  # Ensure there are at least two future jobs scheduled and that the queue ahead time is filled
73
- while (future_run_times + existing_run_times).length < 2 || minutes_queued_ahead(last_run_time) < queue_ahead
73
+ while future_run_times.length < 2 || minutes_queued_ahead(last_run_time) < queue_ahead
74
74
  last_run_time = frequency.from_now(last_run_time)
75
75
  # The hour may not match because of a shift caused by DST in previous run times,
76
76
  # so we need to ensure that the hour matches the specified hour if given.
77
77
  last_run_time = last_run_time.change(hour: at.hour, min: at.min) if at.hour?
78
- future_run_times << last_run_time unless existing_run_times.include?(last_run_time)
78
+ future_run_times << last_run_time
79
79
  end
80
80
 
81
81
  future_run_times
@@ -1,3 +1,3 @@
1
1
  module SimpleScheduler
2
- VERSION = "1.1.0".freeze
2
+ VERSION = "1.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -162,8 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.5.2.3
165
+ rubygems_version: 3.0.3
167
166
  signing_key:
168
167
  specification_version: 4
169
168
  summary: An enhancement for Heroku Scheduler + Sidekiq for scheduling jobs at specific