lambdakiq 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/lambdakiq/job.rb +14 -4
- data/lib/lambdakiq/queue.rb +2 -2
- data/lib/lambdakiq/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: d6c7543a7f0f98a903e576b54cf791eb6efa83336b97a056bc4cce771634b04b
|
4
|
+
data.tar.gz: e03956eb1543b0c5f5576aee3dd007e62567be052059aa166e5c28efdefdd5af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20af5bc0de3846af919e8593187b180c78f3a04a953983529e0f0bdb73d6adb411e43d1e06c87bc31777f53e513cb2812ea703522a21fefc87a81cf46bd1c5ce
|
7
|
+
data.tar.gz: 978de57e0ec0c92019b1e5ff2946eb9447e2182886d61e68392ce999162317281ad96c58c216e4f00f4b23e77fb5dea16b3f5259ed95c66f1b498c27008f72e9
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/lambdakiq/job.rb
CHANGED
@@ -72,7 +72,11 @@ module Lambdakiq
|
|
72
72
|
@error = e
|
73
73
|
else
|
74
74
|
instrument :retry_stopped, error: e
|
75
|
-
|
75
|
+
if should_redrive?
|
76
|
+
@error = e
|
77
|
+
else
|
78
|
+
delete_message
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -97,10 +101,16 @@ module Lambdakiq
|
|
97
101
|
executions > retry_limit
|
98
102
|
end
|
99
103
|
|
104
|
+
def job_retry
|
105
|
+
[active_job.lambdakiq_retry, Lambdakiq.config.max_retries, 12].compact.min
|
106
|
+
end
|
107
|
+
|
100
108
|
def retry_limit
|
101
|
-
|
102
|
-
|
103
|
-
|
109
|
+
[job_retry, (queue.max_receive_count - 1)].min
|
110
|
+
end
|
111
|
+
|
112
|
+
def should_redrive?
|
113
|
+
!queue.redrive_policy.nil? && job_retry >= queue.max_receive_count
|
104
114
|
end
|
105
115
|
|
106
116
|
def fifo_delay?
|
data/lib/lambdakiq/queue.rb
CHANGED
@@ -22,11 +22,11 @@ module Lambdakiq
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def redrive_policy
|
25
|
-
@redrive_policy ||= JSON.parse(attributes['RedrivePolicy'])
|
25
|
+
@redrive_policy ||= attributes['RedrivePolicy'] ? JSON.parse(attributes['RedrivePolicy']) : nil
|
26
26
|
end
|
27
27
|
|
28
28
|
def max_receive_count
|
29
|
-
redrive_policy
|
29
|
+
redrive_policy&.dig('maxReceiveCount')&.to_i || 1
|
30
30
|
end
|
31
31
|
|
32
32
|
def fifo?
|
data/lib/lambdakiq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lambdakiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|