aws-sdk-rails 3.10.0 → 3.11.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6ff9a7f26db95b0ae83526c594bb985b991da455979daf7d2a6ea92be0a5187
|
4
|
+
data.tar.gz: bbb91361034021720e0f43058777b530212d6c43d489f23999b636dd7e187edb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28a3bf351332f237ef4ce23bbcdb6115ac41468d14dd3d2e1eb76c7a395c33697c9f8c55412fdad3a2b4fc63cbf7dca350243bdf5651743a7ccadfb9adebb0a
|
7
|
+
data.tar.gz: 80076e9047b439cdbd4fe8fe2da651b3cc9d23ed3346fb22c32724b9b3e00463dd77a52f99934bfe26c79ce6d9cc9a17d74fdf6683c9dc5b85e52c40a80f0d9d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.11.0
|
@@ -25,6 +25,7 @@ module Aws
|
|
25
25
|
DEFAULTS = {
|
26
26
|
max_messages: 10,
|
27
27
|
shutdown_timeout: 15,
|
28
|
+
retry_standard_errors: true, # TODO: Remove in next MV
|
28
29
|
queues: {},
|
29
30
|
logger: ::Rails.logger,
|
30
31
|
message_group_id: 'SqsActiveJobGroup',
|
@@ -64,6 +65,16 @@ module Aws
|
|
64
65
|
# will not be deleted from the SQS queue and will be retryable after
|
65
66
|
# the visibility timeout.
|
66
67
|
#
|
68
|
+
# @ option options [Boolean] :retry_standard_errors
|
69
|
+
# If `true`, StandardErrors raised by ActiveJobs are left on the queue
|
70
|
+
# and will be retried (pending the SQS Queue's redrive/DLQ/maximum receive settings).
|
71
|
+
# This behavior overrides the standard Rails ActiveJob
|
72
|
+
# [Retry/Discard for failed jobs](https://guides.rubyonrails.org/active_job_basics.html#retrying-or-discarding-failed-jobs)
|
73
|
+
# behavior. When set to `true` the retries provided by this will be
|
74
|
+
# on top of any retries configured on the job with `retry_on`.
|
75
|
+
# When `false`, retry behavior is fully configured
|
76
|
+
# through `retry_on`/`discard_on` on the ActiveJobs.
|
77
|
+
#
|
67
78
|
# @option options [ActiveSupport::Logger] :logger Logger to use
|
68
79
|
# for the poller.
|
69
80
|
#
|
@@ -13,14 +13,15 @@ module Aws
|
|
13
13
|
auto_terminate: true,
|
14
14
|
idletime: 60, # 1 minute
|
15
15
|
fallback_policy: :caller_runs # slow down the producer thread
|
16
|
+
# TODO: Consider catching the exception and sleeping instead of using :caller_runs
|
16
17
|
}.freeze
|
17
18
|
|
18
19
|
def initialize(options = {})
|
19
20
|
@executor = Concurrent::ThreadPoolExecutor.new(DEFAULTS.merge(options))
|
21
|
+
@retry_standard_errors = options[:retry_standard_errors]
|
20
22
|
@logger = options[:logger] || ActiveSupport::Logger.new($stdout)
|
21
23
|
end
|
22
24
|
|
23
|
-
# TODO: Consider catching the exception and sleeping instead of using :caller_runs
|
24
25
|
def execute(message)
|
25
26
|
@executor.post(message) do |message|
|
26
27
|
begin
|
@@ -31,10 +32,18 @@ module Aws
|
|
31
32
|
rescue Aws::Json::ParseError => e
|
32
33
|
@logger.error "Unable to parse message body: #{message.data.body}. Error: #{e}."
|
33
34
|
rescue StandardError => e
|
34
|
-
# message will not be deleted and will be retried
|
35
35
|
job_msg = job ? "#{job.id}[#{job.class_name}]" : 'unknown job'
|
36
36
|
@logger.info "Error processing job #{job_msg}: #{e}"
|
37
37
|
@logger.debug e.backtrace.join("\n")
|
38
|
+
|
39
|
+
if @retry_standard_errors && !job.exception_executions?
|
40
|
+
@logger.info(
|
41
|
+
'retry_standard_errors is enabled and job has not ' \
|
42
|
+
"been retried by Rails. Leaving #{job_msg} in the queue."
|
43
|
+
)
|
44
|
+
else
|
45
|
+
message.delete
|
46
|
+
end
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|
@@ -16,7 +16,8 @@ module Aws
|
|
16
16
|
threads: 2 * Concurrent.processor_count,
|
17
17
|
max_messages: 10,
|
18
18
|
shutdown_timeout: 15,
|
19
|
-
backpressure: 10
|
19
|
+
backpressure: 10,
|
20
|
+
retry_standard_errors: true
|
20
21
|
}.freeze
|
21
22
|
|
22
23
|
def initialize(args = ARGV)
|
@@ -45,7 +46,12 @@ module Aws
|
|
45
46
|
|
46
47
|
Signal.trap('INT') { raise Interrupt }
|
47
48
|
Signal.trap('TERM') { raise Interrupt }
|
48
|
-
@executor = Executor.new(
|
49
|
+
@executor = Executor.new(
|
50
|
+
max_threads: @options[:threads],
|
51
|
+
logger: @logger,
|
52
|
+
max_queue: @options[:backpressure],
|
53
|
+
retry_standard_errors: @options[:retry_standard_errors]
|
54
|
+
)
|
49
55
|
|
50
56
|
poll
|
51
57
|
rescue Interrupt
|
@@ -99,6 +105,7 @@ module Aws
|
|
99
105
|
require File.expand_path('config/environment.rb')
|
100
106
|
end
|
101
107
|
|
108
|
+
# rubocop:disable Metrics
|
102
109
|
def parse_args(argv)
|
103
110
|
out = {}
|
104
111
|
parser = ::OptionParser.new do |opts|
|
@@ -127,6 +134,10 @@ module Aws
|
|
127
134
|
'The amount of time to wait for a clean shutdown. Jobs that are unable to complete in this time will not be deleted from the SQS queue and will be retryable after the visibility timeout.') do |a|
|
128
135
|
out[:shutdown_timeout] = a
|
129
136
|
end
|
137
|
+
opts.on('--[no-]retry_standard_errors [FLAG]', TrueClass,
|
138
|
+
'When set, retry all StandardErrors (leaving failed messages on the SQS Queue). These retries are ON TOP of standard Rails ActiveJob retries set by retry_on in the ActiveJob.') do |a|
|
139
|
+
out[:retry_standard_errors] = a.nil? ? true : a
|
140
|
+
end
|
130
141
|
end
|
131
142
|
|
132
143
|
parser.banner = 'aws_sqs_active_job [options]'
|
@@ -138,6 +149,7 @@ module Aws
|
|
138
149
|
parser.parse(argv)
|
139
150
|
out
|
140
151
|
end
|
152
|
+
# rubocop:enable Metrics
|
141
153
|
|
142
154
|
def validate_config
|
143
155
|
raise ArgumentError, 'You must specify the name of the queue to process jobs from' unless @options[:queue]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01
|
11
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-record
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
- !ruby/object:Gem::Version
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
|
-
rubygems_version: 3.4.
|
201
|
+
rubygems_version: 3.4.1
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: AWS SDK for Ruby on Rails Plugin
|