inst-jobs 0.13.7 → 0.14.0
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/{bin → exe}/inst_jobs +0 -0
- data/lib/delayed/daemon.rb +1 -9
- data/lib/delayed/logging.rb +4 -0
- data/lib/delayed/pool.rb +103 -27
- data/lib/delayed/settings.rb +16 -9
- data/lib/delayed/version.rb +1 -1
- data/lib/delayed/work_queue/in_process.rb +4 -0
- data/lib/delayed/work_queue/parent_process/client.rb +20 -4
- data/lib/delayed/work_queue/parent_process/server.rb +17 -2
- data/lib/delayed/worker.rb +51 -21
- data/spec/delayed/daemon_spec.rb +2 -2
- data/spec/delayed/work_queue/parent_process/client_spec.rb +5 -0
- data/spec/gemfiles/42.gemfile.lock +52 -49
- data/spec/gemfiles/50.gemfile.lock +60 -61
- data/spec/gemfiles/51.gemfile.lock +187 -0
- data/spec/shared/worker.rb +0 -1
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee8d7326e878b8571d349ec95ae6b6b8870c8ca9
|
|
4
|
+
data.tar.gz: 43c64c727119ba15d95a0a7f2e39c102068c1cce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9e12899372899fe7ae9ee0c2e692cbad12244f22f3507279ce7c4f9426f876bb058ef632c53c8c1b70d6c010bb9a7b63c441b6733b8fdfca77d2246ef358381
|
|
7
|
+
data.tar.gz: 4e77f257047f61b065e0505994974d718a4f6a98b3ef956a640dc825f2eee3a6a07d24d10a0e0be017fce9aa034a630809b550460254d94a7eac2c7819306a51
|
data/{bin → exe}/inst_jobs
RENAMED
|
File without changes
|
data/lib/delayed/daemon.rb
CHANGED
|
@@ -56,15 +56,7 @@ class Daemon
|
|
|
56
56
|
alive = status(pid: pid, print: false)
|
|
57
57
|
if alive == :running || (kill && alive == :draining)
|
|
58
58
|
puts "Stopping pool #{pid}..."
|
|
59
|
-
signal = '
|
|
60
|
-
if kill
|
|
61
|
-
pid = -pid # send to the whole group
|
|
62
|
-
if kill == 9
|
|
63
|
-
signal = 'KILL'
|
|
64
|
-
else
|
|
65
|
-
signal = 'TERM'
|
|
66
|
-
end
|
|
67
|
-
end
|
|
59
|
+
signal = kill ? 'TERM' : 'QUIT'
|
|
68
60
|
begin
|
|
69
61
|
Process.kill(signal, pid)
|
|
70
62
|
rescue Errno::ESRCH
|
data/lib/delayed/logging.rb
CHANGED
data/lib/delayed/pool.rb
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
module Delayed
|
|
2
2
|
class Pool
|
|
3
|
+
include Delayed::Logging
|
|
4
|
+
|
|
3
5
|
mattr_accessor :on_fork
|
|
4
6
|
self.on_fork = ->{ }
|
|
5
7
|
|
|
8
|
+
SIGNALS = %i{INT TERM QUIT}
|
|
9
|
+
POOL_SLEEP_PERIOD = 5
|
|
10
|
+
|
|
6
11
|
attr_reader :workers
|
|
7
12
|
|
|
8
13
|
def initialize(*args)
|
|
@@ -12,6 +17,8 @@ class Pool
|
|
|
12
17
|
warn "Calling Delayed::Pool.new directly is deprecated. Use `Delayed::CLI.new.run()` instead."
|
|
13
18
|
end
|
|
14
19
|
@workers = {}
|
|
20
|
+
@signal_queue = []
|
|
21
|
+
@self_pipe = IO.pipe
|
|
15
22
|
end
|
|
16
23
|
|
|
17
24
|
def run
|
|
@@ -21,6 +28,7 @@ class Pool
|
|
|
21
28
|
|
|
22
29
|
def start
|
|
23
30
|
say "Started job master", :info
|
|
31
|
+
SIGNALS.each { |sig| trap(sig) { @signal_queue << sig; wake_up } }
|
|
24
32
|
$0 = procname
|
|
25
33
|
# fork to handle unlocking (to prevent polluting the parent with worker objects)
|
|
26
34
|
unlock_pid = fork_with_reconnects do
|
|
@@ -33,8 +41,8 @@ class Pool
|
|
|
33
41
|
say "Workers spawned"
|
|
34
42
|
join
|
|
35
43
|
say "Shutting down"
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
stop
|
|
45
|
+
reap_all_children
|
|
38
46
|
rescue Exception => e
|
|
39
47
|
say "Job master died with error: #{e.inspect}\n#{e.backtrace.join("\n")}", :fatal
|
|
40
48
|
raise
|
|
@@ -46,14 +54,6 @@ class Pool
|
|
|
46
54
|
"delayed_jobs_pool#{Settings.pool_procname_suffix}"
|
|
47
55
|
end
|
|
48
56
|
|
|
49
|
-
def say(msg, level = :debug)
|
|
50
|
-
if defined?(Rails.logger) && Rails.logger
|
|
51
|
-
Rails.logger.send(level, "[#{Process.pid}]P #{msg}")
|
|
52
|
-
else
|
|
53
|
-
puts(msg)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
57
|
def unlock_orphaned_jobs(worker = nil, pid = nil)
|
|
58
58
|
return if Settings.disable_automatic_orphan_unlocking
|
|
59
59
|
|
|
@@ -136,26 +136,102 @@ class Pool
|
|
|
136
136
|
|
|
137
137
|
def join
|
|
138
138
|
loop do
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
139
|
+
maintain_children
|
|
140
|
+
case sig = @signal_queue.shift
|
|
141
|
+
when nil
|
|
142
|
+
pool_sleep
|
|
143
|
+
when :QUIT
|
|
144
|
+
break
|
|
145
|
+
when :TERM, :INT
|
|
146
|
+
stop(graceful: false) if Settings.kill_workers_on_exit
|
|
147
|
+
break
|
|
148
|
+
else
|
|
149
|
+
logger.warn("Unexpected signal received: #{sig}")
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def pool_sleep
|
|
155
|
+
IO.select([@self_pipe[0]], nil, nil, POOL_SLEEP_PERIOD)
|
|
156
|
+
@self_pipe[0].read_nonblock(11, exception: false)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def stop(graceful: true, timeout: Settings.slow_exit_timeout)
|
|
160
|
+
signal_for_children = graceful ? :QUIT : :TERM
|
|
161
|
+
if Settings.kill_workers_on_exit
|
|
162
|
+
limit = Time.now + timeout
|
|
163
|
+
until @workers.empty? || Time.now >= limit
|
|
164
|
+
signal_all_children(signal_for_children)
|
|
165
|
+
# Give our children some time to process the signal before checking if
|
|
166
|
+
# they've exited
|
|
167
|
+
sleep(0.5)
|
|
168
|
+
reap_all_children.each { |pid| @workers.delete(pid) }
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# We really want to give the workers every oportunity to clean up after
|
|
172
|
+
# themselves before murdering them.
|
|
173
|
+
stop(graceful: false, timeout: 2) if graceful
|
|
174
|
+
signal_all_children(:KILL)
|
|
175
|
+
else
|
|
176
|
+
signal_all_children(signal_for_children)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def signal_all_children(signal)
|
|
181
|
+
workers.keys.each { |pid| signal_child(signal, pid) }
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def signal_child(signal, pid)
|
|
185
|
+
Process.kill(signal, pid)
|
|
186
|
+
rescue Erron::ESRCH
|
|
187
|
+
workers.delete(pid)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Respawn all children that have exited since we last checked
|
|
191
|
+
def maintain_children
|
|
192
|
+
reap_all_children.each do |pid|
|
|
193
|
+
respawn_child(pid)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Reaps processes that have exited or just returns if none have exited
|
|
198
|
+
#
|
|
199
|
+
# @return Array An array of child pids that have exited
|
|
200
|
+
def reap_all_children
|
|
201
|
+
exited_pids = []
|
|
202
|
+
begin
|
|
203
|
+
pid = Process.wait(-1, Process::WNOHANG)
|
|
204
|
+
break unless pid
|
|
205
|
+
exited_pids << pid
|
|
206
|
+
rescue Errno::ECHILD
|
|
207
|
+
break
|
|
208
|
+
end while true # I hate doing loops this way but it's the only way to make the rescue work
|
|
209
|
+
exited_pids
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def respawn_child(child)
|
|
213
|
+
if workers.include?(child)
|
|
214
|
+
worker = workers.delete(child)
|
|
215
|
+
case worker
|
|
216
|
+
when :periodic_audit
|
|
217
|
+
say "ran auditor: #{worker}"
|
|
218
|
+
when :work_queue
|
|
219
|
+
say "work queue exited, restarting", :info
|
|
220
|
+
spawn_work_queue
|
|
221
|
+
else
|
|
222
|
+
say "child exited: #{child}, restarting", :info
|
|
223
|
+
# fork to handle unlocking (to prevent polluting the parent with worker objects)
|
|
224
|
+
unlock_pid = fork_with_reconnects do
|
|
225
|
+
unlock_orphaned_jobs(worker, child)
|
|
156
226
|
end
|
|
227
|
+
Process.wait unlock_pid
|
|
228
|
+
spawn_worker(worker.config)
|
|
157
229
|
end
|
|
158
230
|
end
|
|
159
231
|
end
|
|
232
|
+
|
|
233
|
+
def wake_up
|
|
234
|
+
@self_pipe[1].write_nonblock('.', exception: false)
|
|
235
|
+
end
|
|
160
236
|
end
|
|
161
237
|
end
|
data/lib/delayed/settings.rb
CHANGED
|
@@ -5,19 +5,21 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
|
5
5
|
module Delayed
|
|
6
6
|
module Settings
|
|
7
7
|
SETTINGS = [
|
|
8
|
-
:queue,
|
|
9
|
-
:max_attempts,
|
|
10
|
-
:sleep_delay,
|
|
11
|
-
:sleep_delay_stagger,
|
|
12
|
-
:fetch_batch_size,
|
|
13
|
-
:select_random_from_batch,
|
|
14
|
-
:worker_procname_prefix,
|
|
15
|
-
:pool_procname_suffix,
|
|
16
8
|
:default_job_options,
|
|
17
|
-
:silence_periodic_log,
|
|
18
9
|
:disable_periodic_jobs,
|
|
19
10
|
:disable_automatic_orphan_unlocking,
|
|
11
|
+
:fetch_batch_size,
|
|
12
|
+
:kill_workers_on_exit,
|
|
20
13
|
:last_ditch_logfile,
|
|
14
|
+
:max_attempts,
|
|
15
|
+
:pool_procname_suffix,
|
|
16
|
+
:queue,
|
|
17
|
+
:select_random_from_batch,
|
|
18
|
+
:silence_periodic_log,
|
|
19
|
+
:sleep_delay,
|
|
20
|
+
:sleep_delay_stagger,
|
|
21
|
+
:slow_exit_timeout,
|
|
22
|
+
:worker_procname_prefix,
|
|
21
23
|
]
|
|
22
24
|
SETTINGS_WITH_ARGS = [ :num_strands ]
|
|
23
25
|
|
|
@@ -62,6 +64,11 @@ module Delayed
|
|
|
62
64
|
self.num_strands = ->(strand_name){ nil }
|
|
63
65
|
self.default_job_options = ->{ Hash.new }
|
|
64
66
|
|
|
67
|
+
# Send workers KILL after QUIT if they haven't exited within the
|
|
68
|
+
# slow_exit_timeout
|
|
69
|
+
self.kill_workers_on_exit = true
|
|
70
|
+
self.slow_exit_timeout = 20
|
|
71
|
+
|
|
65
72
|
def self.worker_config(config_filename = nil)
|
|
66
73
|
config_filename ||= default_worker_config_name
|
|
67
74
|
config = YAML.load(ERB.new(File.read(config_filename)).result)
|
data/lib/delayed/version.rb
CHANGED
|
@@ -9,6 +9,11 @@ class ParentProcess
|
|
|
9
9
|
def initialize(addrinfo, config: Settings.parent_process)
|
|
10
10
|
@addrinfo = addrinfo
|
|
11
11
|
@connect_timeout = config['client_connect_timeout'] || 2
|
|
12
|
+
@self_pipe = IO.pipe
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def close
|
|
16
|
+
reset_connection
|
|
12
17
|
end
|
|
13
18
|
|
|
14
19
|
def get_and_lock_next_available(worker_name, worker_config)
|
|
@@ -24,11 +29,18 @@ class ParentProcess
|
|
|
24
29
|
return reset_connection
|
|
25
30
|
end
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
readers, _, _ = IO.select([socket, @self_pipe[0]])
|
|
33
|
+
|
|
34
|
+
if readers.include?(@self_pipe[0])
|
|
35
|
+
# we're probably exiting so we just want to break out of the blocking read
|
|
36
|
+
logger.debug("Broke out of select due to being awakened, exiting")
|
|
37
|
+
else
|
|
38
|
+
Marshal.load(socket).tap do |response|
|
|
39
|
+
unless response.nil? || (response.is_a?(Delayed::Job) && response.locked_by == worker_name)
|
|
40
|
+
raise(ProtocolError, "response is not a locked job: #{response.inspect}")
|
|
41
|
+
end
|
|
42
|
+
logger.debug("Received job #{response.id}")
|
|
30
43
|
end
|
|
31
|
-
logger.debug("Received job #{response.id}")
|
|
32
44
|
end
|
|
33
45
|
rescue SystemCallError, IOError => ex
|
|
34
46
|
logger.error("Work queue connection lost, reestablishing on next poll. (#{ex})")
|
|
@@ -37,6 +49,10 @@ class ParentProcess
|
|
|
37
49
|
reset_connection
|
|
38
50
|
end
|
|
39
51
|
|
|
52
|
+
def wake_up
|
|
53
|
+
@self_pipe[1].write_nonblock('.', exception: false)
|
|
54
|
+
end
|
|
55
|
+
|
|
40
56
|
private
|
|
41
57
|
|
|
42
58
|
def socket
|
|
@@ -5,6 +5,7 @@ class ParentProcess
|
|
|
5
5
|
attr_reader :clients, :listen_socket
|
|
6
6
|
|
|
7
7
|
include Delayed::Logging
|
|
8
|
+
SIGNALS = %i{INT TERM QUIT CHLD}
|
|
8
9
|
|
|
9
10
|
def initialize(listen_socket, parent_pid: nil, config: Settings.parent_process)
|
|
10
11
|
@listen_socket = listen_socket
|
|
@@ -15,6 +16,9 @@ class ParentProcess
|
|
|
15
16
|
|
|
16
17
|
@config = config
|
|
17
18
|
@client_timeout = config['server_socket_timeout'] || 10.0 # left for backwards compat
|
|
19
|
+
|
|
20
|
+
@exit = false
|
|
21
|
+
@self_pipe = IO.pipe
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
def connected_clients
|
|
@@ -30,6 +34,13 @@ class ParentProcess
|
|
|
30
34
|
def run
|
|
31
35
|
logger.debug "Starting work queue process"
|
|
32
36
|
|
|
37
|
+
SIGNALS.each do |sig|
|
|
38
|
+
# We're not doing any aggressive exiting here since we really want
|
|
39
|
+
# prefetched jobs to be unlocked and we're going to wake up the process
|
|
40
|
+
# from the IO.select we're using to wait on clients.
|
|
41
|
+
trap(sig) { @exit = true; @self_pipe[1].write_nonblock('.', exception: false) }
|
|
42
|
+
end
|
|
43
|
+
|
|
33
44
|
last_orphaned_prefetched_jobs_purge = Job.db_time_now - rand(15 * 60)
|
|
34
45
|
while !exit?
|
|
35
46
|
run_once
|
|
@@ -47,7 +58,7 @@ class ParentProcess
|
|
|
47
58
|
end
|
|
48
59
|
|
|
49
60
|
def run_once
|
|
50
|
-
handles = @clients.keys + [@listen_socket]
|
|
61
|
+
handles = @clients.keys + [@listen_socket, @self_pipe[0]]
|
|
51
62
|
timeout = Settings.sleep_delay + (rand * Settings.sleep_delay_stagger)
|
|
52
63
|
readable, _, _ = IO.select(handles, nil, nil, timeout)
|
|
53
64
|
if readable
|
|
@@ -60,6 +71,10 @@ class ParentProcess
|
|
|
60
71
|
def handle_read(socket)
|
|
61
72
|
if socket == @listen_socket
|
|
62
73
|
handle_accept
|
|
74
|
+
elsif socket == @self_pipe[0]
|
|
75
|
+
# We really don't care about the contents of the pipe, we just need to
|
|
76
|
+
# wake up.
|
|
77
|
+
@self_pipe[0].read_nonblock(11, exception: false)
|
|
63
78
|
else
|
|
64
79
|
handle_request(socket)
|
|
65
80
|
end
|
|
@@ -194,7 +209,7 @@ class ParentProcess
|
|
|
194
209
|
end
|
|
195
210
|
|
|
196
211
|
def exit?
|
|
197
|
-
parent_exited?
|
|
212
|
+
!!@exit || parent_exited?
|
|
198
213
|
end
|
|
199
214
|
|
|
200
215
|
def prefetch_owner
|
data/lib/delayed/worker.rb
CHANGED
|
@@ -6,6 +6,9 @@ require 'tmpdir'
|
|
|
6
6
|
require 'set'
|
|
7
7
|
|
|
8
8
|
class Worker
|
|
9
|
+
include Delayed::Logging
|
|
10
|
+
SIGNALS = %i{INT TERM QUIT CHLD}
|
|
11
|
+
|
|
9
12
|
attr_reader :config, :queue_name, :min_priority, :max_priority, :work_queue
|
|
10
13
|
|
|
11
14
|
# Callback to fire when a delayed job fails max_attempts times. If this
|
|
@@ -51,13 +54,16 @@ class Worker
|
|
|
51
54
|
@config = options
|
|
52
55
|
@job_count = 0
|
|
53
56
|
|
|
57
|
+
@self_pipe = IO.pipe
|
|
58
|
+
@signal_queue = []
|
|
59
|
+
|
|
54
60
|
app = Rails.application
|
|
55
61
|
if app && !app.config.cache_classes
|
|
56
|
-
Delayed::Worker.lifecycle.around(:perform) do
|
|
62
|
+
Delayed::Worker.lifecycle.around(:perform) do |worker, job, &block|
|
|
57
63
|
reload = app.config.reload_classes_only_on_change != true || app.reloaders.map(&:updated?).any?
|
|
58
64
|
ActionDispatch::Reloader.prepare! if reload
|
|
59
65
|
begin
|
|
60
|
-
block.call
|
|
66
|
+
block.call(worker, job)
|
|
61
67
|
ensure
|
|
62
68
|
ActionDispatch::Reloader.cleanup! if reload
|
|
63
69
|
end
|
|
@@ -76,27 +82,49 @@ class Worker
|
|
|
76
82
|
end
|
|
77
83
|
|
|
78
84
|
def exit?
|
|
79
|
-
@exit
|
|
85
|
+
@exit
|
|
80
86
|
end
|
|
81
87
|
|
|
82
|
-
def
|
|
83
|
-
@
|
|
88
|
+
def wake_up
|
|
89
|
+
@self_pipe[1].write_nonblock('.', exception: false)
|
|
90
|
+
work_queue.wake_up
|
|
84
91
|
end
|
|
85
92
|
|
|
86
93
|
def start
|
|
87
|
-
|
|
94
|
+
logger.info "Starting worker"
|
|
88
95
|
set_process_name("start:#{Settings.worker_procname_prefix}#{@queue_name}:#{min_priority || 0}:#{max_priority || 'max'}")
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
work_thread = Thread.current
|
|
98
|
+
SIGNALS.each do |sig|
|
|
99
|
+
trap(sig) { @signal_queue << sig; wake_up }
|
|
100
|
+
end
|
|
91
101
|
|
|
92
|
-
|
|
102
|
+
signal_processor = Thread.new do
|
|
93
103
|
loop do
|
|
104
|
+
@self_pipe[0].read(1)
|
|
105
|
+
case @signal_queue.pop
|
|
106
|
+
when :INT, :TERM
|
|
107
|
+
@exit = true # get the main thread to bail early if it's waiting for a job
|
|
108
|
+
work_thread.raise(SystemExit) # Force the main thread to bail out of the current job
|
|
109
|
+
break
|
|
110
|
+
when :QUIT, :CHLD
|
|
111
|
+
@exit = true
|
|
112
|
+
else
|
|
113
|
+
logger.error "Unknown signal '#{sig}' received"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
self.class.lifecycle.run_callbacks(:execute, self) do
|
|
119
|
+
until exit? do
|
|
94
120
|
run
|
|
95
|
-
break if exit?
|
|
96
121
|
end
|
|
97
122
|
end
|
|
98
123
|
|
|
99
|
-
|
|
124
|
+
work_queue.close
|
|
125
|
+
signal_processor.kill
|
|
126
|
+
signal_processor.join
|
|
127
|
+
logger.info "Stopping worker"
|
|
100
128
|
rescue => e
|
|
101
129
|
Rails.logger.fatal("Child process died: #{e.inspect}") rescue nil
|
|
102
130
|
self.class.lifecycle.run_callbacks(:exceptional_exit, self, e) { }
|
|
@@ -105,6 +133,7 @@ class Worker
|
|
|
105
133
|
end
|
|
106
134
|
|
|
107
135
|
def run
|
|
136
|
+
return if exit?
|
|
108
137
|
self.class.lifecycle.run_callbacks(:loop, self) do
|
|
109
138
|
set_process_name("pop:#{Settings.worker_procname_prefix}#{@queue_name}:#{min_priority || 0}:#{max_priority || 'max'}")
|
|
110
139
|
job = self.class.lifecycle.run_callbacks(:pop, self) do
|
|
@@ -116,23 +145,23 @@ class Worker
|
|
|
116
145
|
@job_count += perform(job)
|
|
117
146
|
|
|
118
147
|
if @max_job_count > 0 && @job_count >= @max_job_count
|
|
119
|
-
|
|
148
|
+
logger.debug "Max job count of #{@max_job_count} exceeded, dying"
|
|
120
149
|
@exit = true
|
|
121
150
|
end
|
|
122
151
|
|
|
123
152
|
if @max_memory_usage > 0
|
|
124
153
|
memory = sample_memory
|
|
125
154
|
if memory > @max_memory_usage
|
|
126
|
-
|
|
155
|
+
logger.debug "Memory usage of #{memory} exceeds max of #{@max_memory_usage}, dying"
|
|
127
156
|
@exit = true
|
|
128
157
|
else
|
|
129
|
-
|
|
158
|
+
logger.debug "Memory usage: #{memory}"
|
|
130
159
|
end
|
|
131
160
|
end
|
|
132
161
|
end
|
|
133
162
|
else
|
|
134
163
|
set_process_name("wait:#{Settings.worker_procname_prefix}#{@queue_name}:#{min_priority || 0}:#{max_priority || 'max'}")
|
|
135
|
-
sleep(Settings.sleep_delay + (rand * Settings.sleep_delay_stagger))
|
|
164
|
+
sleep(Settings.sleep_delay + (rand * Settings.sleep_delay_stagger)) unless exit?
|
|
136
165
|
end
|
|
137
166
|
end
|
|
138
167
|
end
|
|
@@ -142,7 +171,7 @@ class Worker
|
|
|
142
171
|
raise Delayed::Backend::JobExpired, "job expired at #{job.expires_at}" if job.expired?
|
|
143
172
|
self.class.lifecycle.run_callbacks(:perform, self, job) do
|
|
144
173
|
set_process_name("run:#{Settings.worker_procname_prefix}#{job.id}:#{job.name}")
|
|
145
|
-
|
|
174
|
+
logger.info("Processing #{log_job(job, :long)}")
|
|
146
175
|
runtime = Benchmark.realtime do
|
|
147
176
|
if job.batch?
|
|
148
177
|
# each job in the batch will have perform called on it, so we don't
|
|
@@ -153,9 +182,14 @@ class Worker
|
|
|
153
182
|
end
|
|
154
183
|
job.destroy
|
|
155
184
|
end
|
|
156
|
-
|
|
185
|
+
logger.info("Completed #{log_job(job)} #{"%.0fms" % (runtime * 1000)}")
|
|
157
186
|
end
|
|
158
187
|
count
|
|
188
|
+
rescue SystemExit
|
|
189
|
+
# There wasn't really a failure here so no callbacks and whatnot needed,
|
|
190
|
+
# still reschedule the job though.
|
|
191
|
+
job.reschedule
|
|
192
|
+
count
|
|
159
193
|
rescue Exception => e
|
|
160
194
|
self.class.lifecycle.run_callbacks(:error, self, job, e) do
|
|
161
195
|
handle_failed_job(job, e)
|
|
@@ -179,7 +213,7 @@ class Worker
|
|
|
179
213
|
|
|
180
214
|
def handle_failed_job(job, error)
|
|
181
215
|
job.last_error = "#{error.message}\n#{error.backtrace.join("\n")}"
|
|
182
|
-
|
|
216
|
+
logger.error("Failed with #{error.class} [#{error.message}] (#{job.attempts} attempts)")
|
|
183
217
|
job.reschedule(error)
|
|
184
218
|
end
|
|
185
219
|
|
|
@@ -187,10 +221,6 @@ class Worker
|
|
|
187
221
|
Process.pid
|
|
188
222
|
end
|
|
189
223
|
|
|
190
|
-
def say(msg, level = :debug)
|
|
191
|
-
Rails.logger.send(level, msg)
|
|
192
|
-
end
|
|
193
|
-
|
|
194
224
|
def log_job(job, format = :short)
|
|
195
225
|
case format
|
|
196
226
|
when :long
|
data/spec/delayed/daemon_spec.rb
CHANGED
|
@@ -24,10 +24,10 @@ RSpec.describe Delayed::Daemon do
|
|
|
24
24
|
subject.stop
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
it 'sends
|
|
27
|
+
it 'sends QUIT by default' do
|
|
28
28
|
expect(subject).to receive(:status).with(print: false, pid: pid).and_return(:running)
|
|
29
29
|
expect(subject).to receive(:puts).with(/Stopping pool/)
|
|
30
|
-
expect(Process).to receive(:kill).with('
|
|
30
|
+
expect(Process).to receive(:kill).with('QUIT', pid)
|
|
31
31
|
expect(subject).to receive(:wait).with(false)
|
|
32
32
|
subject.stop
|
|
33
33
|
end
|
|
@@ -21,6 +21,7 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
|
|
|
21
21
|
it 'marshals the given arguments to the server and returns the response' do
|
|
22
22
|
expect(addrinfo).to receive(:connect).once.and_return(connection)
|
|
23
23
|
expect(connection).to receive(:eof?).and_return(false)
|
|
24
|
+
expect(IO).to receive(:select).and_return([[connection], nil, nil])
|
|
24
25
|
expect(Marshal).to receive(:dump).with(args, connection).ordered
|
|
25
26
|
expect(Marshal).to receive(:load).with(connection).and_return(job).ordered
|
|
26
27
|
response = subject.get_and_lock_next_available(*args)
|
|
@@ -30,6 +31,7 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
|
|
|
30
31
|
it 'returns nil and then reconnects on socket write error' do
|
|
31
32
|
expect(addrinfo).to receive(:connect).once.and_return(connection)
|
|
32
33
|
expect(Marshal).to receive(:dump).and_raise(SystemCallError.new("failure"))
|
|
34
|
+
expect(IO).to receive(:select).and_return([[connection], nil, nil])
|
|
33
35
|
expect(connection).to receive(:close)
|
|
34
36
|
response = subject.get_and_lock_next_available(*args)
|
|
35
37
|
expect(response).to be_nil
|
|
@@ -46,6 +48,7 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
|
|
|
46
48
|
expect(addrinfo).to receive(:connect).once.and_return(connection)
|
|
47
49
|
expect(connection).to receive(:eof?).and_return(true)
|
|
48
50
|
expect(Marshal).to receive(:dump).with(args, connection).ordered
|
|
51
|
+
expect(IO).to receive(:select).and_return([[connection], nil, nil])
|
|
49
52
|
expect(connection).to receive(:close)
|
|
50
53
|
response = subject.get_and_lock_next_available(*args)
|
|
51
54
|
expect(response).to be_nil
|
|
@@ -61,6 +64,7 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
|
|
|
61
64
|
it 'errors if the response is not a locked job' do
|
|
62
65
|
expect(addrinfo).to receive(:connect).once.and_return(connection)
|
|
63
66
|
expect(Marshal).to receive(:dump).with(args, connection)
|
|
67
|
+
expect(IO).to receive(:select).and_return([[connection], nil, nil])
|
|
64
68
|
expect(Marshal).to receive(:load).with(connection).and_return(:not_a_job)
|
|
65
69
|
expect(connection).to receive(:eof?).and_return(false)
|
|
66
70
|
|
|
@@ -71,6 +75,7 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
|
|
|
71
75
|
expect(addrinfo).to receive(:connect).once.and_return(connection)
|
|
72
76
|
expect(Marshal).to receive(:dump).with(args, connection)
|
|
73
77
|
job.locked_by = "somebody_else"
|
|
78
|
+
expect(IO).to receive(:select).and_return([[connection], nil, nil])
|
|
74
79
|
expect(Marshal).to receive(:load).with(connection).and_return(job)
|
|
75
80
|
expect(connection).to receive(:eof?).and_return(false)
|
|
76
81
|
|
|
@@ -1,98 +1,100 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../..
|
|
3
3
|
specs:
|
|
4
|
-
inst-jobs (0.
|
|
5
|
-
after_transaction_commit (
|
|
4
|
+
inst-jobs (0.13.4)
|
|
5
|
+
after_transaction_commit (>= 1.0, < 3)
|
|
6
6
|
rails (>= 4.2)
|
|
7
7
|
redis (> 3.0)
|
|
8
8
|
redis-scripting (~> 1.0.1)
|
|
9
|
-
rufus-scheduler (~> 3.
|
|
9
|
+
rufus-scheduler (~> 3.4)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
actionmailer (4.2.
|
|
15
|
-
actionpack (= 4.2.
|
|
16
|
-
actionview (= 4.2.
|
|
17
|
-
activejob (= 4.2.
|
|
14
|
+
actionmailer (4.2.9)
|
|
15
|
+
actionpack (= 4.2.9)
|
|
16
|
+
actionview (= 4.2.9)
|
|
17
|
+
activejob (= 4.2.9)
|
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
|
19
19
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
20
|
-
actionpack (4.2.
|
|
21
|
-
actionview (= 4.2.
|
|
22
|
-
activesupport (= 4.2.
|
|
20
|
+
actionpack (4.2.9)
|
|
21
|
+
actionview (= 4.2.9)
|
|
22
|
+
activesupport (= 4.2.9)
|
|
23
23
|
rack (~> 1.6)
|
|
24
24
|
rack-test (~> 0.6.2)
|
|
25
25
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
-
actionview (4.2.
|
|
28
|
-
activesupport (= 4.2.
|
|
27
|
+
actionview (4.2.9)
|
|
28
|
+
activesupport (= 4.2.9)
|
|
29
29
|
builder (~> 3.1)
|
|
30
30
|
erubis (~> 2.7.0)
|
|
31
31
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
32
32
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
33
|
-
activejob (4.2.
|
|
34
|
-
activesupport (= 4.2.
|
|
33
|
+
activejob (4.2.9)
|
|
34
|
+
activesupport (= 4.2.9)
|
|
35
35
|
globalid (>= 0.3.0)
|
|
36
|
-
activemodel (4.2.
|
|
37
|
-
activesupport (= 4.2.
|
|
36
|
+
activemodel (4.2.9)
|
|
37
|
+
activesupport (= 4.2.9)
|
|
38
38
|
builder (~> 3.1)
|
|
39
|
-
activerecord (4.2.
|
|
40
|
-
activemodel (= 4.2.
|
|
41
|
-
activesupport (= 4.2.
|
|
39
|
+
activerecord (4.2.9)
|
|
40
|
+
activemodel (= 4.2.9)
|
|
41
|
+
activesupport (= 4.2.9)
|
|
42
42
|
arel (~> 6.0)
|
|
43
|
-
activesupport (4.2.
|
|
43
|
+
activesupport (4.2.9)
|
|
44
44
|
i18n (~> 0.7)
|
|
45
45
|
minitest (~> 5.1)
|
|
46
46
|
thread_safe (~> 0.3, >= 0.3.4)
|
|
47
47
|
tzinfo (~> 1.1)
|
|
48
|
-
after_transaction_commit (1.1.
|
|
48
|
+
after_transaction_commit (1.1.2)
|
|
49
49
|
activerecord (>= 4.0)
|
|
50
50
|
arel (6.0.4)
|
|
51
|
-
backports (3.
|
|
51
|
+
backports (3.8.0)
|
|
52
52
|
builder (3.2.3)
|
|
53
|
-
bump (0.5.
|
|
53
|
+
bump (0.5.4)
|
|
54
54
|
byebug (9.0.6)
|
|
55
55
|
coderay (1.1.1)
|
|
56
56
|
concurrent-ruby (1.0.5)
|
|
57
|
-
database_cleaner (1.
|
|
57
|
+
database_cleaner (1.6.1)
|
|
58
58
|
diff-lcs (1.3)
|
|
59
59
|
erubis (2.7.0)
|
|
60
|
+
et-orbi (1.0.5)
|
|
61
|
+
tzinfo
|
|
60
62
|
globalid (0.4.0)
|
|
61
63
|
activesupport (>= 4.2.0)
|
|
62
|
-
i18n (0.8.
|
|
64
|
+
i18n (0.8.6)
|
|
63
65
|
loofah (2.0.3)
|
|
64
66
|
nokogiri (>= 1.5.9)
|
|
65
|
-
mail (2.6.
|
|
67
|
+
mail (2.6.6)
|
|
66
68
|
mime-types (>= 1.16, < 4)
|
|
67
69
|
method_source (0.8.2)
|
|
68
70
|
mime-types (3.1)
|
|
69
71
|
mime-types-data (~> 3.2015)
|
|
70
72
|
mime-types-data (3.2016.0521)
|
|
71
|
-
mini_portile2 (2.
|
|
72
|
-
minitest (5.10.
|
|
73
|
+
mini_portile2 (2.2.0)
|
|
74
|
+
minitest (5.10.3)
|
|
73
75
|
multi_json (1.12.1)
|
|
74
|
-
nokogiri (1.
|
|
75
|
-
mini_portile2 (~> 2.
|
|
76
|
-
pg (0.
|
|
76
|
+
nokogiri (1.8.0)
|
|
77
|
+
mini_portile2 (~> 2.2.0)
|
|
78
|
+
pg (0.21.0)
|
|
77
79
|
pry (0.10.4)
|
|
78
80
|
coderay (~> 1.1.0)
|
|
79
81
|
method_source (~> 0.8.1)
|
|
80
82
|
slop (~> 3.4)
|
|
81
|
-
rack (1.6.
|
|
83
|
+
rack (1.6.8)
|
|
82
84
|
rack-protection (1.5.3)
|
|
83
85
|
rack
|
|
84
86
|
rack-test (0.6.3)
|
|
85
87
|
rack (>= 1.0)
|
|
86
|
-
rails (4.2.
|
|
87
|
-
actionmailer (= 4.2.
|
|
88
|
-
actionpack (= 4.2.
|
|
89
|
-
actionview (= 4.2.
|
|
90
|
-
activejob (= 4.2.
|
|
91
|
-
activemodel (= 4.2.
|
|
92
|
-
activerecord (= 4.2.
|
|
93
|
-
activesupport (= 4.2.
|
|
88
|
+
rails (4.2.9)
|
|
89
|
+
actionmailer (= 4.2.9)
|
|
90
|
+
actionpack (= 4.2.9)
|
|
91
|
+
actionview (= 4.2.9)
|
|
92
|
+
activejob (= 4.2.9)
|
|
93
|
+
activemodel (= 4.2.9)
|
|
94
|
+
activerecord (= 4.2.9)
|
|
95
|
+
activesupport (= 4.2.9)
|
|
94
96
|
bundler (>= 1.3.0, < 2.0)
|
|
95
|
-
railties (= 4.2.
|
|
97
|
+
railties (= 4.2.9)
|
|
96
98
|
sprockets-rails
|
|
97
99
|
rails-deprecated_sanitizer (1.0.3)
|
|
98
100
|
activesupport (>= 4.2.0.alpha)
|
|
@@ -102,9 +104,9 @@ GEM
|
|
|
102
104
|
rails-deprecated_sanitizer (>= 1.0.1)
|
|
103
105
|
rails-html-sanitizer (1.0.3)
|
|
104
106
|
loofah (~> 2.0)
|
|
105
|
-
railties (4.2.
|
|
106
|
-
actionpack (= 4.2.
|
|
107
|
-
activesupport (= 4.2.
|
|
107
|
+
railties (4.2.9)
|
|
108
|
+
actionpack (= 4.2.9)
|
|
109
|
+
activesupport (= 4.2.9)
|
|
108
110
|
rake (>= 0.8.7)
|
|
109
111
|
thor (>= 0.18.1, < 2.0)
|
|
110
112
|
rake (12.0.0)
|
|
@@ -124,8 +126,8 @@ GEM
|
|
|
124
126
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
125
127
|
rspec-support (~> 3.4.0)
|
|
126
128
|
rspec-support (3.4.1)
|
|
127
|
-
rufus-scheduler (3.
|
|
128
|
-
|
|
129
|
+
rufus-scheduler (3.4.2)
|
|
130
|
+
et-orbi (~> 1.0)
|
|
129
131
|
sinatra (1.4.8)
|
|
130
132
|
rack (~> 1.5)
|
|
131
133
|
rack-protection (~> 1.4)
|
|
@@ -149,7 +151,7 @@ GEM
|
|
|
149
151
|
activerecord (>= 3.2)
|
|
150
152
|
thor (0.19.4)
|
|
151
153
|
thread_safe (0.3.6)
|
|
152
|
-
tilt (2.0.
|
|
154
|
+
tilt (2.0.8)
|
|
153
155
|
timecop (0.7.1)
|
|
154
156
|
tzinfo (1.2.3)
|
|
155
157
|
thread_safe (~> 0.1)
|
|
@@ -159,9 +161,10 @@ PLATFORMS
|
|
|
159
161
|
ruby
|
|
160
162
|
|
|
161
163
|
DEPENDENCIES
|
|
164
|
+
after_transaction_commit (< 2)
|
|
162
165
|
bump
|
|
163
166
|
byebug
|
|
164
|
-
database_cleaner (= 1.
|
|
167
|
+
database_cleaner (= 1.6.1)
|
|
165
168
|
inst-jobs!
|
|
166
169
|
pg
|
|
167
170
|
pry
|
|
@@ -176,4 +179,4 @@ DEPENDENCIES
|
|
|
176
179
|
wwtd (~> 1.3.0)
|
|
177
180
|
|
|
178
181
|
BUNDLED WITH
|
|
179
|
-
1.
|
|
182
|
+
1.15.3
|
|
@@ -1,113 +1,115 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../..
|
|
3
3
|
specs:
|
|
4
|
-
inst-jobs (0.
|
|
5
|
-
after_transaction_commit (
|
|
4
|
+
inst-jobs (0.13.4)
|
|
5
|
+
after_transaction_commit (>= 1.0, < 3)
|
|
6
6
|
rails (>= 4.2)
|
|
7
7
|
redis (> 3.0)
|
|
8
8
|
redis-scripting (~> 1.0.1)
|
|
9
|
-
rufus-scheduler (~> 3.
|
|
9
|
+
rufus-scheduler (~> 3.4)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
actioncable (5.0.
|
|
15
|
-
actionpack (= 5.0.
|
|
14
|
+
actioncable (5.0.5)
|
|
15
|
+
actionpack (= 5.0.5)
|
|
16
16
|
nio4r (>= 1.2, < 3.0)
|
|
17
17
|
websocket-driver (~> 0.6.1)
|
|
18
|
-
actionmailer (5.0.
|
|
19
|
-
actionpack (= 5.0.
|
|
20
|
-
actionview (= 5.0.
|
|
21
|
-
activejob (= 5.0.
|
|
18
|
+
actionmailer (5.0.5)
|
|
19
|
+
actionpack (= 5.0.5)
|
|
20
|
+
actionview (= 5.0.5)
|
|
21
|
+
activejob (= 5.0.5)
|
|
22
22
|
mail (~> 2.5, >= 2.5.4)
|
|
23
23
|
rails-dom-testing (~> 2.0)
|
|
24
|
-
actionpack (5.0.
|
|
25
|
-
actionview (= 5.0.
|
|
26
|
-
activesupport (= 5.0.
|
|
24
|
+
actionpack (5.0.5)
|
|
25
|
+
actionview (= 5.0.5)
|
|
26
|
+
activesupport (= 5.0.5)
|
|
27
27
|
rack (~> 2.0)
|
|
28
28
|
rack-test (~> 0.6.3)
|
|
29
29
|
rails-dom-testing (~> 2.0)
|
|
30
30
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
31
|
-
actionview (5.0.
|
|
32
|
-
activesupport (= 5.0.
|
|
31
|
+
actionview (5.0.5)
|
|
32
|
+
activesupport (= 5.0.5)
|
|
33
33
|
builder (~> 3.1)
|
|
34
34
|
erubis (~> 2.7.0)
|
|
35
35
|
rails-dom-testing (~> 2.0)
|
|
36
36
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
37
|
-
activejob (5.0.
|
|
38
|
-
activesupport (= 5.0.
|
|
37
|
+
activejob (5.0.5)
|
|
38
|
+
activesupport (= 5.0.5)
|
|
39
39
|
globalid (>= 0.3.6)
|
|
40
|
-
activemodel (5.0.
|
|
41
|
-
activesupport (= 5.0.
|
|
42
|
-
activerecord (5.0.
|
|
43
|
-
activemodel (= 5.0.
|
|
44
|
-
activesupport (= 5.0.
|
|
40
|
+
activemodel (5.0.5)
|
|
41
|
+
activesupport (= 5.0.5)
|
|
42
|
+
activerecord (5.0.5)
|
|
43
|
+
activemodel (= 5.0.5)
|
|
44
|
+
activesupport (= 5.0.5)
|
|
45
45
|
arel (~> 7.0)
|
|
46
|
-
activesupport (5.0.
|
|
46
|
+
activesupport (5.0.5)
|
|
47
47
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
48
48
|
i18n (~> 0.7)
|
|
49
49
|
minitest (~> 5.1)
|
|
50
50
|
tzinfo (~> 1.1)
|
|
51
|
-
after_transaction_commit (
|
|
52
|
-
activerecord (>=
|
|
51
|
+
after_transaction_commit (2.0.0)
|
|
52
|
+
activerecord (>= 5.0)
|
|
53
53
|
arel (7.1.4)
|
|
54
|
-
backports (3.
|
|
54
|
+
backports (3.8.0)
|
|
55
55
|
builder (3.2.3)
|
|
56
|
-
bump (0.5.
|
|
56
|
+
bump (0.5.4)
|
|
57
57
|
byebug (9.0.6)
|
|
58
58
|
coderay (1.1.1)
|
|
59
59
|
concurrent-ruby (1.0.5)
|
|
60
|
-
database_cleaner (1.
|
|
60
|
+
database_cleaner (1.6.1)
|
|
61
61
|
diff-lcs (1.3)
|
|
62
62
|
erubis (2.7.0)
|
|
63
|
+
et-orbi (1.0.5)
|
|
64
|
+
tzinfo
|
|
63
65
|
globalid (0.4.0)
|
|
64
66
|
activesupport (>= 4.2.0)
|
|
65
|
-
i18n (0.8.
|
|
67
|
+
i18n (0.8.6)
|
|
66
68
|
loofah (2.0.3)
|
|
67
69
|
nokogiri (>= 1.5.9)
|
|
68
|
-
mail (2.6.
|
|
70
|
+
mail (2.6.6)
|
|
69
71
|
mime-types (>= 1.16, < 4)
|
|
70
72
|
method_source (0.8.2)
|
|
71
73
|
mime-types (3.1)
|
|
72
74
|
mime-types-data (~> 3.2015)
|
|
73
75
|
mime-types-data (3.2016.0521)
|
|
74
|
-
mini_portile2 (2.
|
|
75
|
-
minitest (5.10.
|
|
76
|
+
mini_portile2 (2.2.0)
|
|
77
|
+
minitest (5.10.3)
|
|
76
78
|
multi_json (1.12.1)
|
|
77
79
|
mustermann (1.0.0.beta2)
|
|
78
|
-
nio4r (2.
|
|
79
|
-
nokogiri (1.
|
|
80
|
-
mini_portile2 (~> 2.
|
|
81
|
-
pg (0.
|
|
80
|
+
nio4r (2.1.0)
|
|
81
|
+
nokogiri (1.8.0)
|
|
82
|
+
mini_portile2 (~> 2.2.0)
|
|
83
|
+
pg (0.21.0)
|
|
82
84
|
pry (0.10.4)
|
|
83
85
|
coderay (~> 1.1.0)
|
|
84
86
|
method_source (~> 0.8.1)
|
|
85
87
|
slop (~> 3.4)
|
|
86
|
-
rack (2.0.
|
|
88
|
+
rack (2.0.3)
|
|
87
89
|
rack-protection (2.0.0.beta2)
|
|
88
90
|
rack
|
|
89
91
|
rack-test (0.6.3)
|
|
90
92
|
rack (>= 1.0)
|
|
91
|
-
rails (5.0.
|
|
92
|
-
actioncable (= 5.0.
|
|
93
|
-
actionmailer (= 5.0.
|
|
94
|
-
actionpack (= 5.0.
|
|
95
|
-
actionview (= 5.0.
|
|
96
|
-
activejob (= 5.0.
|
|
97
|
-
activemodel (= 5.0.
|
|
98
|
-
activerecord (= 5.0.
|
|
99
|
-
activesupport (= 5.0.
|
|
100
|
-
bundler (>= 1.3.0
|
|
101
|
-
railties (= 5.0.
|
|
93
|
+
rails (5.0.5)
|
|
94
|
+
actioncable (= 5.0.5)
|
|
95
|
+
actionmailer (= 5.0.5)
|
|
96
|
+
actionpack (= 5.0.5)
|
|
97
|
+
actionview (= 5.0.5)
|
|
98
|
+
activejob (= 5.0.5)
|
|
99
|
+
activemodel (= 5.0.5)
|
|
100
|
+
activerecord (= 5.0.5)
|
|
101
|
+
activesupport (= 5.0.5)
|
|
102
|
+
bundler (>= 1.3.0)
|
|
103
|
+
railties (= 5.0.5)
|
|
102
104
|
sprockets-rails (>= 2.0.0)
|
|
103
|
-
rails-dom-testing (2.0.
|
|
104
|
-
activesupport (>= 4.2.0
|
|
105
|
-
nokogiri (
|
|
105
|
+
rails-dom-testing (2.0.3)
|
|
106
|
+
activesupport (>= 4.2.0)
|
|
107
|
+
nokogiri (>= 1.6)
|
|
106
108
|
rails-html-sanitizer (1.0.3)
|
|
107
109
|
loofah (~> 2.0)
|
|
108
|
-
railties (5.0.
|
|
109
|
-
actionpack (= 5.0.
|
|
110
|
-
activesupport (= 5.0.
|
|
110
|
+
railties (5.0.5)
|
|
111
|
+
actionpack (= 5.0.5)
|
|
112
|
+
activesupport (= 5.0.5)
|
|
111
113
|
method_source
|
|
112
114
|
rake (>= 0.8.7)
|
|
113
115
|
thor (>= 0.18.1, < 2.0)
|
|
@@ -128,8 +130,8 @@ GEM
|
|
|
128
130
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
129
131
|
rspec-support (~> 3.4.0)
|
|
130
132
|
rspec-support (3.4.1)
|
|
131
|
-
rufus-scheduler (3.
|
|
132
|
-
|
|
133
|
+
rufus-scheduler (3.4.2)
|
|
134
|
+
et-orbi (~> 1.0)
|
|
133
135
|
sinatra (2.0.0.beta2)
|
|
134
136
|
mustermann (= 1.0.0.beta2)
|
|
135
137
|
rack (~> 2.0)
|
|
@@ -151,11 +153,9 @@ GEM
|
|
|
151
153
|
actionpack (>= 4.0)
|
|
152
154
|
activesupport (>= 4.0)
|
|
153
155
|
sprockets (>= 3.0.0)
|
|
154
|
-
test_after_commit (0.4.1)
|
|
155
|
-
activerecord (>= 3.2)
|
|
156
156
|
thor (0.19.4)
|
|
157
157
|
thread_safe (0.3.6)
|
|
158
|
-
tilt (2.0.
|
|
158
|
+
tilt (2.0.8)
|
|
159
159
|
timecop (0.7.1)
|
|
160
160
|
tzinfo (1.2.3)
|
|
161
161
|
thread_safe (~> 0.1)
|
|
@@ -170,7 +170,7 @@ PLATFORMS
|
|
|
170
170
|
DEPENDENCIES
|
|
171
171
|
bump
|
|
172
172
|
byebug
|
|
173
|
-
database_cleaner (= 1.
|
|
173
|
+
database_cleaner (= 1.6.1)
|
|
174
174
|
inst-jobs!
|
|
175
175
|
pg
|
|
176
176
|
pry
|
|
@@ -180,9 +180,8 @@ DEPENDENCIES
|
|
|
180
180
|
rspec (= 3.4.0)
|
|
181
181
|
sinatra (= 2.0.0.beta2)
|
|
182
182
|
sinatra-contrib (= 2.0.0.beta2)
|
|
183
|
-
test_after_commit (= 0.4.1)
|
|
184
183
|
timecop (= 0.7.1)
|
|
185
184
|
wwtd (~> 1.3.0)
|
|
186
185
|
|
|
187
186
|
BUNDLED WITH
|
|
188
|
-
1.
|
|
187
|
+
1.15.3
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../..
|
|
3
|
+
specs:
|
|
4
|
+
inst-jobs (0.13.3)
|
|
5
|
+
after_transaction_commit (~> 1.0)
|
|
6
|
+
rails (>= 4.2)
|
|
7
|
+
redis (> 3.0)
|
|
8
|
+
redis-scripting (~> 1.0.1)
|
|
9
|
+
rufus-scheduler (~> 3.4)
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
actioncable (5.1.1)
|
|
15
|
+
actionpack (= 5.1.1)
|
|
16
|
+
nio4r (~> 2.0)
|
|
17
|
+
websocket-driver (~> 0.6.1)
|
|
18
|
+
actionmailer (5.1.1)
|
|
19
|
+
actionpack (= 5.1.1)
|
|
20
|
+
actionview (= 5.1.1)
|
|
21
|
+
activejob (= 5.1.1)
|
|
22
|
+
mail (~> 2.5, >= 2.5.4)
|
|
23
|
+
rails-dom-testing (~> 2.0)
|
|
24
|
+
actionpack (5.1.1)
|
|
25
|
+
actionview (= 5.1.1)
|
|
26
|
+
activesupport (= 5.1.1)
|
|
27
|
+
rack (~> 2.0)
|
|
28
|
+
rack-test (~> 0.6.3)
|
|
29
|
+
rails-dom-testing (~> 2.0)
|
|
30
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
31
|
+
actionview (5.1.1)
|
|
32
|
+
activesupport (= 5.1.1)
|
|
33
|
+
builder (~> 3.1)
|
|
34
|
+
erubi (~> 1.4)
|
|
35
|
+
rails-dom-testing (~> 2.0)
|
|
36
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
37
|
+
activejob (5.1.1)
|
|
38
|
+
activesupport (= 5.1.1)
|
|
39
|
+
globalid (>= 0.3.6)
|
|
40
|
+
activemodel (5.1.1)
|
|
41
|
+
activesupport (= 5.1.1)
|
|
42
|
+
activerecord (5.1.1)
|
|
43
|
+
activemodel (= 5.1.1)
|
|
44
|
+
activesupport (= 5.1.1)
|
|
45
|
+
arel (~> 8.0)
|
|
46
|
+
activesupport (5.1.1)
|
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
48
|
+
i18n (~> 0.7)
|
|
49
|
+
minitest (~> 5.1)
|
|
50
|
+
tzinfo (~> 1.1)
|
|
51
|
+
after_transaction_commit (1.1.2)
|
|
52
|
+
activerecord (>= 4.0)
|
|
53
|
+
arel (8.0.0)
|
|
54
|
+
backports (3.7.0)
|
|
55
|
+
builder (3.2.3)
|
|
56
|
+
bump (0.5.3)
|
|
57
|
+
byebug (9.0.6)
|
|
58
|
+
coderay (1.1.1)
|
|
59
|
+
concurrent-ruby (1.0.5)
|
|
60
|
+
database_cleaner (1.6.1)
|
|
61
|
+
diff-lcs (1.3)
|
|
62
|
+
erubi (1.6.0)
|
|
63
|
+
et-orbi (1.0.3)
|
|
64
|
+
tzinfo
|
|
65
|
+
globalid (0.4.0)
|
|
66
|
+
activesupport (>= 4.2.0)
|
|
67
|
+
i18n (0.8.4)
|
|
68
|
+
loofah (2.0.3)
|
|
69
|
+
nokogiri (>= 1.5.9)
|
|
70
|
+
mail (2.6.6)
|
|
71
|
+
mime-types (>= 1.16, < 4)
|
|
72
|
+
method_source (0.8.2)
|
|
73
|
+
mime-types (3.1)
|
|
74
|
+
mime-types-data (~> 3.2015)
|
|
75
|
+
mime-types-data (3.2016.0521)
|
|
76
|
+
mini_portile2 (2.2.0)
|
|
77
|
+
minitest (5.10.2)
|
|
78
|
+
multi_json (1.12.1)
|
|
79
|
+
mustermann (1.0.0.beta2)
|
|
80
|
+
nio4r (2.1.0)
|
|
81
|
+
nokogiri (1.8.0)
|
|
82
|
+
mini_portile2 (~> 2.2.0)
|
|
83
|
+
pg (0.21.0)
|
|
84
|
+
pry (0.10.4)
|
|
85
|
+
coderay (~> 1.1.0)
|
|
86
|
+
method_source (~> 0.8.1)
|
|
87
|
+
slop (~> 3.4)
|
|
88
|
+
rack (2.0.3)
|
|
89
|
+
rack-protection (2.0.0.beta2)
|
|
90
|
+
rack
|
|
91
|
+
rack-test (0.6.3)
|
|
92
|
+
rack (>= 1.0)
|
|
93
|
+
rails (5.1.1)
|
|
94
|
+
actioncable (= 5.1.1)
|
|
95
|
+
actionmailer (= 5.1.1)
|
|
96
|
+
actionpack (= 5.1.1)
|
|
97
|
+
actionview (= 5.1.1)
|
|
98
|
+
activejob (= 5.1.1)
|
|
99
|
+
activemodel (= 5.1.1)
|
|
100
|
+
activerecord (= 5.1.1)
|
|
101
|
+
activesupport (= 5.1.1)
|
|
102
|
+
bundler (>= 1.3.0, < 2.0)
|
|
103
|
+
railties (= 5.1.1)
|
|
104
|
+
sprockets-rails (>= 2.0.0)
|
|
105
|
+
rails-dom-testing (2.0.3)
|
|
106
|
+
activesupport (>= 4.2.0)
|
|
107
|
+
nokogiri (>= 1.6)
|
|
108
|
+
rails-html-sanitizer (1.0.3)
|
|
109
|
+
loofah (~> 2.0)
|
|
110
|
+
railties (5.1.1)
|
|
111
|
+
actionpack (= 5.1.1)
|
|
112
|
+
activesupport (= 5.1.1)
|
|
113
|
+
method_source
|
|
114
|
+
rake (>= 0.8.7)
|
|
115
|
+
thor (>= 0.18.1, < 2.0)
|
|
116
|
+
rake (12.0.0)
|
|
117
|
+
redis (3.3.3)
|
|
118
|
+
redis-scripting (1.0.1)
|
|
119
|
+
redis (>= 3.0)
|
|
120
|
+
rspec (3.4.0)
|
|
121
|
+
rspec-core (~> 3.4.0)
|
|
122
|
+
rspec-expectations (~> 3.4.0)
|
|
123
|
+
rspec-mocks (~> 3.4.0)
|
|
124
|
+
rspec-core (3.4.4)
|
|
125
|
+
rspec-support (~> 3.4.0)
|
|
126
|
+
rspec-expectations (3.4.0)
|
|
127
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
128
|
+
rspec-support (~> 3.4.0)
|
|
129
|
+
rspec-mocks (3.4.1)
|
|
130
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
131
|
+
rspec-support (~> 3.4.0)
|
|
132
|
+
rspec-support (3.4.1)
|
|
133
|
+
rufus-scheduler (3.4.0)
|
|
134
|
+
et-orbi (~> 1.0)
|
|
135
|
+
sinatra (2.0.0.beta2)
|
|
136
|
+
mustermann (= 1.0.0.beta2)
|
|
137
|
+
rack (~> 2.0)
|
|
138
|
+
rack-protection (= 2.0.0.beta2)
|
|
139
|
+
tilt (~> 2.0)
|
|
140
|
+
sinatra-contrib (2.0.0.beta2)
|
|
141
|
+
backports (>= 2.0)
|
|
142
|
+
multi_json
|
|
143
|
+
mustermann (= 1.0.0.beta2)
|
|
144
|
+
rack-protection (= 2.0.0.beta2)
|
|
145
|
+
rack-test
|
|
146
|
+
sinatra (= 2.0.0.beta2)
|
|
147
|
+
tilt (>= 1.3, < 3)
|
|
148
|
+
slop (3.6.0)
|
|
149
|
+
sprockets (3.7.1)
|
|
150
|
+
concurrent-ruby (~> 1.0)
|
|
151
|
+
rack (> 1, < 3)
|
|
152
|
+
sprockets-rails (3.2.0)
|
|
153
|
+
actionpack (>= 4.0)
|
|
154
|
+
activesupport (>= 4.0)
|
|
155
|
+
sprockets (>= 3.0.0)
|
|
156
|
+
thor (0.19.4)
|
|
157
|
+
thread_safe (0.3.6)
|
|
158
|
+
tilt (2.0.7)
|
|
159
|
+
timecop (0.7.1)
|
|
160
|
+
tzinfo (1.2.3)
|
|
161
|
+
thread_safe (~> 0.1)
|
|
162
|
+
websocket-driver (0.6.5)
|
|
163
|
+
websocket-extensions (>= 0.1.0)
|
|
164
|
+
websocket-extensions (0.1.2)
|
|
165
|
+
wwtd (1.3.0)
|
|
166
|
+
|
|
167
|
+
PLATFORMS
|
|
168
|
+
ruby
|
|
169
|
+
|
|
170
|
+
DEPENDENCIES
|
|
171
|
+
bump
|
|
172
|
+
byebug
|
|
173
|
+
database_cleaner (= 1.6.1)
|
|
174
|
+
inst-jobs!
|
|
175
|
+
pg
|
|
176
|
+
pry
|
|
177
|
+
rack-test
|
|
178
|
+
rails (~> 5.1.0)
|
|
179
|
+
rake
|
|
180
|
+
rspec (= 3.4.0)
|
|
181
|
+
sinatra (= 2.0.0.beta2)
|
|
182
|
+
sinatra-contrib (= 2.0.0.beta2)
|
|
183
|
+
timecop (= 0.7.1)
|
|
184
|
+
wwtd (~> 1.3.0)
|
|
185
|
+
|
|
186
|
+
BUNDLED WITH
|
|
187
|
+
1.14.6
|
data/spec/shared/worker.rb
CHANGED
|
@@ -373,7 +373,6 @@ shared_examples_for 'Delayed::Worker' do
|
|
|
373
373
|
describe "#start" do
|
|
374
374
|
it "fires off an execute callback on the processing jobs loop" do
|
|
375
375
|
fired = false
|
|
376
|
-
expect(@worker).to receive(:run)
|
|
377
376
|
expect(@worker).to receive(:exit?).and_return(true)
|
|
378
377
|
Delayed::Worker.lifecycle.before(:execute) { |w| w == @worker && fired = true }
|
|
379
378
|
@worker.start
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inst-jobs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Luetke
|
|
8
8
|
- Brian Palmer
|
|
9
9
|
autorequire:
|
|
10
|
-
bindir:
|
|
10
|
+
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-
|
|
12
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: after_transaction_commit
|
|
@@ -263,7 +263,6 @@ executables:
|
|
|
263
263
|
extensions: []
|
|
264
264
|
extra_rdoc_files: []
|
|
265
265
|
files:
|
|
266
|
-
- bin/inst_jobs
|
|
267
266
|
- db/migrate/20101216224513_create_delayed_jobs.rb
|
|
268
267
|
- db/migrate/20110208031356_add_delayed_jobs_tag.rb
|
|
269
268
|
- db/migrate/20110426161613_add_delayed_jobs_max_attempts.rb
|
|
@@ -285,6 +284,7 @@ files:
|
|
|
285
284
|
- db/migrate/20151123210429_add_expires_at_to_jobs.rb
|
|
286
285
|
- db/migrate/20151210162949_improve_max_concurrent.rb
|
|
287
286
|
- db/migrate/20161206323555_add_back_default_string_limits_jobs.rb
|
|
287
|
+
- exe/inst_jobs
|
|
288
288
|
- lib/delayed/backend/active_record.rb
|
|
289
289
|
- lib/delayed/backend/base.rb
|
|
290
290
|
- lib/delayed/backend/redis/bulk_update.lua
|
|
@@ -343,6 +343,7 @@ files:
|
|
|
343
343
|
- spec/gemfiles/50.gemfile
|
|
344
344
|
- spec/gemfiles/50.gemfile.lock
|
|
345
345
|
- spec/gemfiles/51.gemfile
|
|
346
|
+
- spec/gemfiles/51.gemfile.lock
|
|
346
347
|
- spec/migrate/20140924140513_add_story_table.rb
|
|
347
348
|
- spec/redis_job_spec.rb
|
|
348
349
|
- spec/sample_jobs.rb
|
|
@@ -373,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
373
374
|
version: '0'
|
|
374
375
|
requirements: []
|
|
375
376
|
rubyforge_project:
|
|
376
|
-
rubygems_version: 2.6.
|
|
377
|
+
rubygems_version: 2.6.13
|
|
377
378
|
signing_key:
|
|
378
379
|
specification_version: 4
|
|
379
380
|
summary: Instructure-maintained fork of delayed_job
|
|
@@ -393,6 +394,7 @@ test_files:
|
|
|
393
394
|
- spec/gemfiles/50.gemfile
|
|
394
395
|
- spec/gemfiles/50.gemfile.lock
|
|
395
396
|
- spec/gemfiles/51.gemfile
|
|
397
|
+
- spec/gemfiles/51.gemfile.lock
|
|
396
398
|
- spec/migrate/20140924140513_add_story_table.rb
|
|
397
399
|
- spec/redis_job_spec.rb
|
|
398
400
|
- spec/sample_jobs.rb
|