rjob 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rjob/context.rb +21 -0
- data/lib/rjob/version.rb +1 -1
- data/lib/rjob/worker_process.rb +19 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a449a71e4bc05ab0aa01d605cfd96ef3e1133377829750749c2c8cf0759a11d2
|
4
|
+
data.tar.gz: 0fbe17674cc2dbb924c85b431a0160afc85eee4cc9598923c2bf6c61a5af9530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3079717e2b8cf013a383b4026794af68c2b52aece9633be7bc1aa3880161091b78dd4a9d717754a0e61de1cfe6492969ab2bd92781c948beb03cda7258c3a7e
|
7
|
+
data.tar.gz: 3a7578b5135a1b7932e6c88b40111bf529068b950f71497ea423a1ae85d3ee502cca5e505bd1a2bafadaa34378e71a7fb970e0c54d963c53566f0a9625cd21f9
|
data/lib/rjob/context.rb
CHANGED
@@ -58,6 +58,27 @@ class Rjob::Context
|
|
58
58
|
load_redis_scripts
|
59
59
|
end
|
60
60
|
|
61
|
+
def dead_job_count()
|
62
|
+
redis { |r| r.llen("#{@prefix}:dead") }
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_dead_jobs(count=1, offset=0, keyname: 'ohh-dead')
|
66
|
+
redis do |r|
|
67
|
+
# dead_jobs = r.lrange("#{@prefix}:dead", offset, count < 0 ? -1 : (offset + count - 1))
|
68
|
+
dead_jobs = r.lrange(keyname, offset, count < 0 ? -1 : (offset + count - 1))
|
69
|
+
dead_jobs.map do |error_payload|
|
70
|
+
payload = MessagePack.unpack(error_payload)
|
71
|
+
|
72
|
+
{
|
73
|
+
job: Rjob::Job.deserialize(self, payload['job']),
|
74
|
+
when: Time.at(payload['when']),
|
75
|
+
error_class: payload['error_class'],
|
76
|
+
full_message: payload['message'],
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
61
82
|
def redis(&block)
|
62
83
|
@pool.with(&block)
|
63
84
|
end
|
data/lib/rjob/version.rb
CHANGED
data/lib/rjob/worker_process.rb
CHANGED
@@ -248,6 +248,7 @@ class Rjob::WorkerProcess
|
|
248
248
|
|
249
249
|
if job_processor.stop_retry?
|
250
250
|
move_job_to_dead(job_processor.job_str, bucket, error)
|
251
|
+
notify_job_is_dead(job_processor, error)
|
251
252
|
return
|
252
253
|
end
|
253
254
|
|
@@ -270,6 +271,24 @@ class Rjob::WorkerProcess
|
|
270
271
|
end
|
271
272
|
|
272
273
|
move_job_to_dead(job_processor.job_str, bucket, error)
|
274
|
+
notify_job_is_dead(job_processor, error)
|
275
|
+
end
|
276
|
+
|
277
|
+
def notify_job_is_dead(job_processor, error)
|
278
|
+
if defined?(Honeybadger)
|
279
|
+
job = job_processor.job
|
280
|
+
|
281
|
+
Honeybadger.notify(error, context: {
|
282
|
+
what: 'RJOB_MOVED_TO_DEAD',
|
283
|
+
rjob_class: job.worker_class_name,
|
284
|
+
rjob_args: job.worker_args
|
285
|
+
})
|
286
|
+
end
|
287
|
+
rescue StandardError => e
|
288
|
+
if @context.logger.respond_to?(:error)
|
289
|
+
s = job_processor.respond_to?(:job_str) ? job_processor.job_str : '<unknown>'
|
290
|
+
@context.logger.error("UGHH! Error while notifying dead job error: #{s}")
|
291
|
+
end
|
273
292
|
end
|
274
293
|
|
275
294
|
# TODO: this should probably be in a single redis pipelined operation
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André D. Piske
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
149
|
+
rubygems_version: 3.4.20
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Asynchronous job processing
|