rocketjob 3.4.2 → 3.4.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: 6c3d286a7897bd81bef71df484490bca1c38ef45
4
- data.tar.gz: '09e9db2779c746cd3b96bb72bbe44e9ad1ad6a7f'
3
+ metadata.gz: 72a9239aa38ba9581931c3bd6f1402278b3c9d41
4
+ data.tar.gz: aa360338a810a8853a463149084554978c57774f
5
5
  SHA512:
6
- metadata.gz: c3eba8f0b893631984477714946fa3a89062e6d71d6f122511d36354e5fa2b558d3591ee7716408356084aaebc4e43ff03a8dbeeb74b3dfaa789eb43ae4c8188
7
- data.tar.gz: 711e258fc7d726247f3252e3aea9a3f75407c978bb4f378300faf66fff8e3a9098273dc6eb68084591f6035ed5de37e7a3ba7f1c809a40b9be1945cc2c67a2cd
6
+ metadata.gz: 1ba33a298630312129bc76f34084e49a348e27bba34e6f452a7d990a0c96d800c664db58b04724503d2cdcdd944a3120ccf09e583661453fb93832d2d38458b3
7
+ data.tar.gz: f141cfbd428307638df1ac8ed20d00e345483370e6c4c40523d9409d2afc6f2d23b8c49d8b27c6eedac4aa72b48d6168dbfd1880b43cd20aaf452fdf223e4ce9
@@ -46,12 +46,17 @@ module RocketJob
46
46
  field :queued_retention, type: Integer, user_editable: true, copy_on_restart: true
47
47
 
48
48
  def perform
49
- RocketJob::Server.destroy_zombies if destroy_zombies
49
+ if destroy_zombies
50
+ # Cleanup zombie servers
51
+ RocketJob::Server.destroy_zombies
52
+ # Requeue jobs where the worker is in the zombie state and its server has gone away
53
+ RocketJob::ActiveWorker.requeue_zombies
54
+ end
50
55
 
51
- RocketJob::Job.aborted.where(created_at: {'$lte' => aborted_retention.seconds.ago}).destroy_all if aborted_retention
52
- RocketJob::Job.completed.where(created_at: {'$lte' => completed_retention.seconds.ago}).destroy_all if completed_retention
53
- RocketJob::Job.failed.where(created_at: {'$lte' => failed_retention.seconds.ago}).destroy_all if failed_retention
54
- RocketJob::Job.paused.where(created_at: {'$lte' => paused_retention.seconds.ago}).destroy_all if paused_retention
56
+ RocketJob::Job.aborted.where(completed_at: {'$lte' => aborted_retention.seconds.ago}).destroy_all if aborted_retention
57
+ RocketJob::Job.completed.where(completed_at: {'$lte' => completed_retention.seconds.ago}).destroy_all if completed_retention
58
+ RocketJob::Job.failed.where(completed_at: {'$lte' => failed_retention.seconds.ago}).destroy_all if failed_retention
59
+ RocketJob::Job.paused.where(completed_at: {'$lte' => paused_retention.seconds.ago}).destroy_all if paused_retention
55
60
  RocketJob::Job.queued.where(created_at: {'$lte' => queued_retention.seconds.ago}).destroy_all if queued_retention
56
61
  end
57
62
 
@@ -1,3 +1,3 @@
1
1
  module RocketJob #:nodoc
2
- VERSION = '3.4.2'
2
+ VERSION = '3.4.3'
3
3
  end
@@ -16,25 +16,39 @@ class HousekeepingJobTest < Minitest::Test
16
16
 
17
17
  describe 'job retention' do
18
18
  before do
19
- job = HousekeepingJobTest::TestJob.new(created_at: 2.days.ago)
20
- job.abort!
21
- job = HousekeepingJobTest::TestJob.new(created_at: 8.days.ago)
22
- job.abort!
19
+ job = HousekeepingJobTest::TestJob.new
20
+ Time.stub(:now, 2.days.ago) do
21
+ job.abort!
22
+ end
23
+ job = HousekeepingJobTest::TestJob.new
24
+ Time.stub(:now, 8.days.ago) do
25
+ job.abort!
26
+ end
23
27
 
24
- job = HousekeepingJobTest::TestJob.new(created_at: 2.days.ago)
25
- job.perform_now
26
- job.save!
27
- job = HousekeepingJobTest::TestJob.new(created_at: 8.days.ago)
28
- job.perform_now
29
- job.save!
28
+ job = HousekeepingJobTest::TestJob.new
29
+ Time.stub(:now, 2.days.ago) do
30
+ job.perform_now
31
+ job.save!
32
+ end
33
+ job = HousekeepingJobTest::TestJob.new
34
+ Time.stub(:now, 8.days.ago) do
35
+ job.perform_now
36
+ job.save!
37
+ end
30
38
 
31
- job = HousekeepingJobTest::TestJob.new(created_at: 2.days.ago)
32
- job.fail!
33
- job = HousekeepingJobTest::TestJob.new(created_at: 15.days.ago)
34
- job.fail!
39
+ job = HousekeepingJobTest::TestJob.new
40
+ Time.stub(:now, 2.days.ago) do
41
+ job.fail!
42
+ end
43
+ job = HousekeepingJobTest::TestJob.new
44
+ Time.stub(:now, 15.days.ago) do
45
+ job.fail!
46
+ end
35
47
 
36
- job = HousekeepingJobTest::TestJob.new(created_at: 400.days.ago)
37
- job.pause!
48
+ job = HousekeepingJobTest::TestJob.new
49
+ Time.stub(:now, 400.days.ago) do
50
+ job.pause!
51
+ end
38
52
  job = HousekeepingJobTest::TestJob.new
39
53
  job.pause!
40
54
 
data/test/test_db.sqlite3 CHANGED
Binary file
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: 3.4.2
4
+ version: 3.4.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: 2017-08-02 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby