rocketjob 2.1.2 → 2.1.3

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: c487cc0cf7d030acbd18c74a651fee0b559d77fa
4
- data.tar.gz: 24a88f78d955288148a8f89e0dd72fa892dddbd6
3
+ metadata.gz: 69c06ffc4a4e337c787f06d36873d763ccced1be
4
+ data.tar.gz: 401c2bda273c7413b0ceda2853aef6c325b15159
5
5
  SHA512:
6
- metadata.gz: 061a09fbc865798f63089a438d061db0383f3abfaa1c00cfc78daa3715fa5e16fcef57dd8def16b5549f8b4e0de5e5e8288aeeefa29e4b6bac53e45f0b6febfc
7
- data.tar.gz: 587f8186e73d7f1bbbcc80a3b3049cf2eabfd69c9f034ae45a68704a7bb1f51400d13e2990fc7291760949a11e021d47d8fb855e0b295341acb2176649b34614
6
+ metadata.gz: 87d8f78b0e766a6d1ab06efb00ff83a3b7b27ade12d11109630f01bed3a753ba8f1fe6241d198209870657ee2e6256d5f6c6ba49293c21ad6dc305c85cc4835e
7
+ data.tar.gz: d87017700e5fb67815b6ce934b73a683d4c08d96ed04e5f802e58ced4a4aa28b2c67be371258c6f643edb6444f90d66e57f0dc1d698b7398dd199bb80eb1d4c6
@@ -17,10 +17,11 @@ module RocketJob
17
17
  module Restart
18
18
  extend ActiveSupport::Concern
19
19
 
20
- # Attributes to exclude when copying across the attributes to the new instance
21
- RESTART_EXCLUDES = %w(_id state created_at started_at completed_at failure_count worker_name percent_complete exception result run_at record_count sub_state)
22
-
23
20
  included do
21
+ # Attributes to exclude when copying across the attributes to the new instance
22
+ class_attribute :rocket_job_restart_excludes
23
+ self.rocket_job_restart_excludes = %w(_id state created_at started_at completed_at failure_count worker_name percent_complete exception result run_at record_count sub_state)
24
+
24
25
  after_abort :rocket_job_restart_new_instance
25
26
  after_complete :rocket_job_restart_new_instance
26
27
  after_fail :rocket_job_restart_abort
@@ -32,7 +33,7 @@ module RocketJob
32
33
  def rocket_job_restart_new_instance
33
34
  return if expired?
34
35
  attrs = attributes.dup
35
- RESTART_EXCLUDES.each { |attr| attrs.delete(attr) }
36
+ rocket_job_restart_excludes.each { |attr| attrs.delete(attr) }
36
37
 
37
38
  # Copy across run_at for future dated jobs
38
39
  attrs['run_at'] = run_at if run_at && (run_at > Time.now)
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module RocketJob #:nodoc
3
- VERSION = '2.1.2'
3
+ VERSION = '2.1.3'
4
4
  end
@@ -6,7 +6,15 @@ module Plugins
6
6
  class RestartableJob < RocketJob::Job
7
7
  include RocketJob::Plugins::Restart
8
8
 
9
+ # Ensure a new start_at and end_at is generated every time this job is restarted
10
+ self.rocket_job_restart_excludes = self.rocket_job_restart_excludes + %w(start_at end_at)
11
+
12
+ key :start_at, Date
13
+ key :end_at, Date
14
+
9
15
  def perform
16
+ self.start_at = Date.today
17
+ self.end_at = Date.today
10
18
  'DONE'
11
19
  end
12
20
  end
@@ -147,11 +155,14 @@ module Plugins
147
155
  assert job2.queued?, job2.attributes.ai
148
156
 
149
157
  # Copy across all attributes, except
150
- @job.attributes.each_pair do |key, value|
151
- next if RocketJob::Plugins::Restart::RESTART_EXCLUDES.include?(key)
158
+ job2.attributes.each_pair do |key, value|
159
+ refute_equal 'start_at', key, "Should not include start_at in retried job. #{job2.attributes.inspect}"
160
+ next if RestartableJob.rocket_job_restart_excludes.include?(key)
152
161
  assert_equal value, job2[key], "Attributes are supposed to be copied across. For #{key}"
153
162
  end
154
163
 
164
+ assert_equal nil, job2.start_at
165
+ assert_equal nil, job2.end_at
155
166
  assert_equal :queued, job2.state
156
167
  assert job2.created_at
157
168
  assert_equal nil, job2.started_at
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby