rocketjob 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rocket_job/plugins/cron.rb +1 -1
- data/lib/rocket_job/version.rb +1 -1
- data/test/plugins/cron_test.rb +25 -5
- 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: 6c3d286a7897bd81bef71df484490bca1c38ef45
|
4
|
+
data.tar.gz: '09e9db2779c746cd3b96bb72bbe44e9ad1ad6a7f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3eba8f0b893631984477714946fa3a89062e6d71d6f122511d36354e5fa2b558d3591ee7716408356084aaebc4e43ff03a8dbeeb74b3dfaa789eb43ae4c8188
|
7
|
+
data.tar.gz: 711e258fc7d726247f3252e3aea9a3f75407c978bb4f378300faf66fff8e3a9098273dc6eb68084591f6035ed5de37e7a3ba7f1c809a40b9be1945cc2c67a2cd
|
data/lib/rocket_job/version.rb
CHANGED
data/test/plugins/cron_test.rb
CHANGED
@@ -11,10 +11,19 @@ module Plugins
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
class FailOnceCronJob < RocketJob::Job
|
15
|
+
include RocketJob::Plugins::Cron
|
16
|
+
|
17
|
+
def perform
|
18
|
+
raise 'oh no' if failure_count == 0
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
14
22
|
describe RocketJob::Plugins::Cron do
|
15
23
|
before do
|
16
24
|
# destroy_all could create new instances
|
17
25
|
CronJob.delete_all
|
26
|
+
FailOnceCronJob.delete_all
|
18
27
|
assert_equal 0, CronJob.count
|
19
28
|
end
|
20
29
|
|
@@ -91,9 +100,12 @@ module Plugins
|
|
91
100
|
describe '#fail' do
|
92
101
|
describe 'with cron_schedule' do
|
93
102
|
let :job do
|
94
|
-
job =
|
103
|
+
job = FailOnceCronJob.create!(cron_schedule: '* 1 * * *')
|
95
104
|
job.start
|
96
|
-
|
105
|
+
assert_raises RuntimeError do
|
106
|
+
job.perform_now
|
107
|
+
end
|
108
|
+
job.reload
|
97
109
|
job
|
98
110
|
end
|
99
111
|
|
@@ -110,13 +122,21 @@ module Plugins
|
|
110
122
|
end
|
111
123
|
|
112
124
|
it 'schedules a new instance' do
|
113
|
-
assert_equal 0,
|
125
|
+
assert_equal 0, FailOnceCronJob.count
|
114
126
|
job
|
115
|
-
assert_equal 2,
|
116
|
-
assert scheduled_job =
|
127
|
+
assert_equal 2, FailOnceCronJob.count
|
128
|
+
assert scheduled_job = FailOnceCronJob.last
|
117
129
|
assert scheduled_job.queued?
|
118
130
|
assert_equal '* 1 * * *', scheduled_job.cron_schedule
|
119
131
|
end
|
132
|
+
|
133
|
+
it 'restarts on retry' do
|
134
|
+
job.retry!
|
135
|
+
job.perform_now
|
136
|
+
assert job.completed?
|
137
|
+
assert_equal 1, FailOnceCronJob.count, -> { FailOnceCronJob.all.to_a.collect(&:state).to_s }
|
138
|
+
assert_equal 1, FailOnceCronJob.queued.count
|
139
|
+
end
|
120
140
|
end
|
121
141
|
|
122
142
|
describe 'without cron_schedule' do
|
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.2
|
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-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|