simple_scheduler 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f15bb865956e8b2d8b84e65ba2baf7386333a5f
4
- data.tar.gz: bf3cd7c9bac2b2d9d2085b8d4b4c55000977c98f
3
+ metadata.gz: b71b4f5c3e484c52baefe6f0a7bb053190cdd0a0
4
+ data.tar.gz: b24a48c76cd13c18c175bd6cf43dafd2beb45632
5
5
  SHA512:
6
- metadata.gz: ca37117e04fcb7c0e4582f702f6262a9051f33c7cfe6f0ee1ce6a80120515128f07ec4a71b3cd5014ce1da5ca1bc424e1b3b86005014bf897c431609b30c3762
7
- data.tar.gz: df9d6c1ccbeb51d64c6ae5c5bd40bc5305cdeeaa4efb214ce7cf4b2f79cc2565aeffb449009fb2cdbc193ccfcbc32d223a3cdf87167f155d4d969d174d3be9de
6
+ metadata.gz: ba009c0d2a0565a03ffcee90c92e69de5cec1aab98f22ec523cee894bc7d200c05229053bebfef02ff9283213002a21f1d1db96ac1aa5b91d5d762f9c349173d
7
+ data.tar.gz: 2ee4e84837c33e00e3d6b2648446ee7cb6d4ecbb6462b20b6cd96acf41e2c26d655c9daa446749cc1a9857ca6c3d3e84de20335580da4b803b2fe0a7c1f0f3fa
data/README.md CHANGED
@@ -162,7 +162,9 @@ a job wasn't run because it expires. Add this block to an initializer file:
162
162
  ```ruby
163
163
  # config/initializers/simple_scheduler.rb
164
164
 
165
+ # Block for handling an expired task from Simple Scheduler
165
166
  # @param exception [SimpleScheduler::FutureJob::Expired]
167
+ # @see http://www.rubydoc.info/github/simplymadeapps/simple_scheduler/master/SimpleScheduler/FutureJob/Expired
166
168
  SimpleScheduler.expired_task do |exception|
167
169
  ExceptionNotifier.notify_exception(
168
170
  exception,
@@ -2,23 +2,23 @@ module SimpleScheduler
2
2
  # Class for parsing each task in the scheduler config YAML file and returning
3
3
  # the values needed to schedule the task in the future.
4
4
  #
5
- # @!attribute at
5
+ # @!attribute [r] at
6
6
  # @return [String] The starting time for the interval
7
- # @!attribute expires_after
7
+ # @!attribute [r] expires_after
8
8
  # @return [String] The time between the scheduled and actual run time that should cause the job not to run
9
- # @!attribute frequency
9
+ # @!attribute [r] frequency
10
10
  # @return [ActiveSupport::Duration] How often the job will be run
11
11
  # @!attribute [r] job_class
12
12
  # @return [Class] The class of the job or worker
13
13
  # @!attribute [r] job_class_name
14
14
  # @return [String] The class name of the job or worker
15
- # @!attribute name
15
+ # @!attribute [r] name
16
16
  # @return [String] The name of the task as defined in the YAML config
17
17
  # @!attribute [r] params
18
18
  # @return [Hash] The params used to create the task
19
- # @!attribute queue_ahead
19
+ # @!attribute [r] queue_ahead
20
20
  # @return [String] The name of the task as defined in the YAML config
21
- # @!attribute time_zone
21
+ # @!attribute [r] time_zone
22
22
  # @return [ActiveSupport::TimeZone] The time zone to use when parsing the `at` option
23
23
  class Task
24
24
  attr_reader :at, :expires_after, :frequency, :job_class, :job_class_name
@@ -56,7 +56,7 @@ module SimpleScheduler
56
56
  @existing_jobs ||= SimpleScheduler::Task.scheduled_set.select do |job|
57
57
  next unless job.display_class == "SimpleScheduler::FutureJob"
58
58
  task_params = job.display_args[0]
59
- task_params[:class] == @job_class_name && task_params[:name] == @name
59
+ task_params["class"] == job_class_name && task_params["name"] == name
60
60
  end.to_a
61
61
  end
62
62
 
@@ -83,9 +83,9 @@ module SimpleScheduler
83
83
  def future_run_times
84
84
  future_run_times = existing_run_times.dup
85
85
  last_run_time = future_run_times.last || first_run_time - frequency
86
- last_run_time = last_run_time.in_time_zone(@time_zone)
86
+ last_run_time = last_run_time.in_time_zone(time_zone)
87
87
 
88
- while future_run_times.length < 2 || ((last_run_time - now) / 1.minute) < @queue_ahead
88
+ while future_run_times.length < 2 || ((last_run_time - now) / 1.minute) < queue_ahead
89
89
  last_run_time = frequency.from_now(last_run_time)
90
90
  last_run_time = last_run_time.change(hour: first_run_hour, min: first_run_min) if at_match[2]
91
91
  future_run_times << last_run_time
@@ -1,3 +1,3 @@
1
1
  module SimpleScheduler
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison