sidekiq-amigo 1.4.0 → 1.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/amigo/retry.rb +15 -1
- data/lib/amigo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11b55a48aa6ca5d7da7217b242c10d13475138071ea22920adcd19a5c8569b2
|
4
|
+
data.tar.gz: 7d6166c366e1299b27e7128ce2db12792ef4cf74a57e932240cf7b288c49827c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61b2bfef602cb1afc8dd06715f717349850065aad462dc4b1a2f39fd4307f96d0d72aefa47b42c3223d71140cb9aee2497522b0efd3063129286a4d2649acb1a
|
7
|
+
data.tar.gz: 17a639b371af4fb0a42d34fa5bc9358ca4daff76790c70081d463442bdeb3e3d33f7c4959c3e48e2bc59b2d3ad1ae62c872c6afb7de9ba529deef3854ea85c47
|
data/lib/amigo/retry.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "sidekiq"
|
4
|
+
require "sidekiq/api"
|
4
5
|
|
5
6
|
# Middleware so Sidekiq workers can use a custom retry logic.
|
6
7
|
# See +Amigo::Retry::Retry+, +Amigo::Retry::Die+,
|
@@ -51,6 +52,12 @@ module Amigo
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
55
|
+
# Raise this error to finish the job. Usually used when there is a fatal error
|
56
|
+
# from deep in a job and they want to jump out of the whole thing.
|
57
|
+
# Usually you should log before raising this!
|
58
|
+
class Quit < Error
|
59
|
+
end
|
60
|
+
|
54
61
|
class ServerMiddleware
|
55
62
|
def call(worker, job, _queue)
|
56
63
|
yield
|
@@ -60,15 +67,22 @@ module Amigo
|
|
60
67
|
handle_die(worker, job, e)
|
61
68
|
rescue Amigo::Retry::OrDie => e
|
62
69
|
handle_retry_or_die(worker, job, e)
|
70
|
+
rescue Amigo::Retry::Quit
|
71
|
+
Sidekiq.logger.info("job_quit")
|
72
|
+
return
|
63
73
|
end
|
64
74
|
|
65
75
|
def handle_retry(worker, job, e)
|
66
76
|
Sidekiq.logger.info("scheduling_retry")
|
77
|
+
job["error_class"] = e.class.to_s
|
78
|
+
job["error_message"] = e.to_s
|
67
79
|
self.amigo_retry_in(worker.class, job, e.interval_or_timestamp)
|
68
80
|
end
|
69
81
|
|
70
|
-
def handle_die(_worker, job,
|
82
|
+
def handle_die(_worker, job, e)
|
71
83
|
Sidekiq.logger.warn("sending_to_deadset")
|
84
|
+
job["error_class"] = e.class.to_s
|
85
|
+
job["error_message"] = e.to_s
|
72
86
|
payload = Sidekiq.dump_json(job)
|
73
87
|
Sidekiq::DeadSet.new.kill(payload, notify_failure: false)
|
74
88
|
end
|
data/lib/amigo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-amigo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lithic Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|