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 +4 -4
- data/lib/rocket_job/jobs/housekeeping_job.rb +10 -5
- data/lib/rocket_job/version.rb +1 -1
- data/test/jobs/housekeeping_job_test.rb +30 -16
- data/test/test_db.sqlite3 +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72a9239aa38ba9581931c3bd6f1402278b3c9d41
|
4
|
+
data.tar.gz: aa360338a810a8853a463149084554978c57774f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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(
|
52
|
-
RocketJob::Job.completed.where(
|
53
|
-
RocketJob::Job.failed.where(
|
54
|
-
RocketJob::Job.paused.where(
|
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
|
|
data/lib/rocket_job/version.rb
CHANGED
@@ -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
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
job.
|
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
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
37
|
-
|
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.
|
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-
|
11
|
+
date: 2017-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|