rocketjob 3.0.1 → 3.0.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/active_worker.rb +1 -1
- data/lib/rocket_job/config.rb +0 -1
- data/lib/rocket_job/heartbeat.rb +0 -1
- data/lib/rocket_job/job.rb +0 -1
- data/lib/rocket_job/job_exception.rb +0 -1
- data/lib/rocket_job/plugins/cron.rb +0 -1
- data/lib/rocket_job/plugins/document.rb +0 -1
- data/lib/rocket_job/plugins/job/callbacks.rb +0 -1
- data/lib/rocket_job/plugins/job/logger.rb +0 -1
- data/lib/rocket_job/plugins/job/model.rb +0 -1
- data/lib/rocket_job/plugins/job/persistence.rb +0 -1
- data/lib/rocket_job/plugins/job/state_machine.rb +0 -1
- data/lib/rocket_job/plugins/job/throttle.rb +0 -1
- data/lib/rocket_job/plugins/job/worker.rb +0 -1
- data/lib/rocket_job/plugins/processing_window.rb +0 -1
- data/lib/rocket_job/plugins/restart.rb +22 -8
- data/lib/rocket_job/plugins/retry.rb +0 -1
- data/lib/rocket_job/plugins/singleton.rb +0 -1
- data/lib/rocket_job/plugins/state_machine.rb +0 -1
- data/lib/rocket_job/server.rb +0 -1
- data/lib/rocket_job/version.rb +1 -2
- data/lib/rocket_job/worker.rb +0 -1
- data/lib/rocketjob.rb +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c812dcc683d598eef994060ede4cfcdeacd0cb0
|
4
|
+
data.tar.gz: e47aba9440145857bdce60e42801696971201632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff08de7a9e29d252e8329966fe508ead35e0c883bac0ab77eab50a94e0404fbd5e4d790619afe626b9611e6edf767e70d08b67853cf10dd68c7d00267688d02b
|
7
|
+
data.tar.gz: 6c95b4d77dba6fb156e2f41714b815ddc8faa503b75bea41df82fbc47197654be9686092a65bfd32a876937fd231ed3cfb82b80e224b97d0ac505c99e55ec361
|
@@ -27,7 +27,7 @@ module RocketJob
|
|
27
27
|
# Requeues all jobs for which the workers have disappeared
|
28
28
|
def self.requeue_zombies
|
29
29
|
all.each do |active_worker|
|
30
|
-
next if !active_worker.zombie? || !active_worker.job.may_requeue?
|
30
|
+
next if !active_worker.zombie? || !active_worker.job.may_requeue?(active_worker.server_name)
|
31
31
|
active_worker.job.requeue!(active_worker.server_name)
|
32
32
|
end
|
33
33
|
end
|
data/lib/rocket_job/config.rb
CHANGED
data/lib/rocket_job/heartbeat.rb
CHANGED
data/lib/rocket_job/job.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
require 'active_support/concern'
|
3
2
|
|
4
3
|
module RocketJob
|
@@ -46,19 +45,34 @@ module RocketJob
|
|
46
45
|
|
47
46
|
# Copy across run_at for future dated jobs
|
48
47
|
attrs['run_at'] = run_at if run_at && (run_at > Time.now)
|
49
|
-
|
50
|
-
|
51
|
-
if job.persisted?
|
52
|
-
logger.info("Started a new job instance: #{job.id}")
|
53
|
-
else
|
54
|
-
logger.info('New job instance not started since one is already active')
|
55
|
-
end
|
48
|
+
|
49
|
+
rocket_job_restart_create(attrs)
|
56
50
|
end
|
57
51
|
|
58
52
|
def rocket_job_restart_abort
|
59
53
|
new_record? ? abort : abort!
|
60
54
|
end
|
61
55
|
|
56
|
+
# Allow Singleton to prevent the creation of a new job if one is already running
|
57
|
+
# Retry since the delete may not have persisted to disk yet.
|
58
|
+
def rocket_job_restart_create(attrs, retry_limit = 3, sleep_interval = 0.1)
|
59
|
+
count = 0
|
60
|
+
while count < retry_limit
|
61
|
+
job = self.class.create(attrs)
|
62
|
+
if job.persisted?
|
63
|
+
logger.info("Started a new job instance: #{job.id}")
|
64
|
+
return true
|
65
|
+
else
|
66
|
+
logger.info('Job already active, retrying after a short sleep')
|
67
|
+
sleep(sleep_interval)
|
68
|
+
end
|
69
|
+
count += 1
|
70
|
+
end
|
71
|
+
logger.warn('New job instance not started since one is already active')
|
72
|
+
false
|
73
|
+
end
|
74
|
+
|
75
|
+
|
62
76
|
end
|
63
77
|
end
|
64
78
|
end
|
data/lib/rocket_job/server.rb
CHANGED
data/lib/rocket_job/version.rb
CHANGED
data/lib/rocket_job/worker.rb
CHANGED
data/lib/rocketjob.rb
CHANGED
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.0.
|
4
|
+
version: 3.0.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-02-
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.3'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: mongo_ha
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.0'
|
83
69
|
description:
|
84
70
|
email:
|
85
71
|
- support@rocketjob.io
|