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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc719ae59b3ba58dca3f268f2be9c3fc96f56c2c40eabee791da33da33b50534
4
- data.tar.gz: 873a8d6563b4e17dcf52534b2776e166aeb0a18cd4992d3d91139bc60f77a4d9
3
+ metadata.gz: d6c7543a7f0f98a903e576b54cf791eb6efa83336b97a056bc4cce771634b04b
4
+ data.tar.gz: e03956eb1543b0c5f5576aee3dd007e62567be052059aa166e5c28efdefdd5af
5
5
  SHA512:
6
- metadata.gz: b830f98d593b7fd995b946889669b8b7c6bf9c450df752abf6b6d17b4bf674ab393000691c5a92f089a07c73bddf99f6375aac4933a046cafefa55bf01bb2586
7
- data.tar.gz: 2cbbd15df392bfc7b3837e22afafd177aaa9db739a0883ac7090772ec028ef05e8c621f575232f9bffe7151dda2789a748096bcadfd6cc8e526b6e30cc712d2a
6
+ metadata.gz: 20af5bc0de3846af919e8593187b180c78f3a04a953983529e0f0bdb73d6adb411e43d1e06c87bc31777f53e513cb2812ea703522a21fefc87a81cf46bd1c5ce
7
+ data.tar.gz: 978de57e0ec0c92019b1e5ff2946eb9447e2182886d61e68392ce999162317281ad96c58c216e4f00f4b23e77fb5dea16b3f5259ed95c66f1b498c27008f72e9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  See this http://keepachangelog.com link for information on how we want this documented formatted.
4
4
 
5
+ ## v2.1.0
6
+
7
+ #### Fixed
8
+
9
+ - Ensure failed messages go to DLQ. Fixes #30. Fixes #31. Thanks @thenano
10
+
5
11
  ## v2.0.2
6
12
 
7
13
  #### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lambdakiq (2.0.2)
4
+ lambdakiq (2.1.0)
5
5
  activejob
6
6
  aws-sdk-sqs
7
7
  concurrent-ruby
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
- delete_message
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
- config_retry = [Lambdakiq.config.max_retries, 12].min
102
- [ (active_job.lambdakiq_retry || config_retry),
103
- (queue.max_receive_count - 1) ].min
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?
@@ -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['maxReceiveCount'].to_i
29
+ redrive_policy&.dig('maxReceiveCount')&.to_i || 1
30
30
  end
31
31
 
32
32
  def fifo?
@@ -1,3 +1,3 @@
1
1
  module Lambdakiq
2
- VERSION = '2.0.2'
2
+ VERSION = '2.1.0'
3
3
  end
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.2
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-08-02 00:00:00.000000000 Z
11
+ date: 2022-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob