aws-sdk-rails 3.6.2 → 3.6.4
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 +4 -4
- data/VERSION +1 -1
- data/lib/active_job/queue_adapters/amazon_sqs_adapter.rb +4 -4
- data/lib/active_job/queue_adapters/amazon_sqs_async_adapter.rb +12 -9
- data/lib/aws/rails/middleware/ebs_sqs_active_job_middleware.rb +2 -2
- data/lib/aws/rails/sqs_active_job/configuration.rb +3 -2
- data/lib/aws/rails/sqs_active_job/poller.rb +0 -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: 12ed1c705f5676b3a71f11c40d1cbc86e2f64b70f1a3183d7dff6ee0dec093d0
|
4
|
+
data.tar.gz: c5963b0723b65ccf6c0f098c878d9c024cb7c2bd0a3dee8773dc6a455c58eb8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77f501b49eae2b7716206ddf37e5eded053d3383d084225e583660e06a637324103d5f83ffc5f003518fb57d4c64472b352ad7b3aeafc908441598de1ad1e178
|
7
|
+
data.tar.gz: 50165f13f842c8d6d435905472666697253ea893d2edb18159f25645c2a50a299573d88a59b43c9e6513da61fd0af900a910a155fcb1f4573dfeff8fefc20d8a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.6.
|
1
|
+
3.6.4
|
@@ -11,16 +11,16 @@ module ActiveJob
|
|
11
11
|
_enqueue(job)
|
12
12
|
end
|
13
13
|
|
14
|
-
def enqueue_at(job, timestamp
|
14
|
+
def enqueue_at(job, timestamp)
|
15
15
|
delay = (timestamp - Time.now.to_f).floor
|
16
16
|
raise ArgumentError, 'Unable to queue a job with a delay great than 15 minutes' if delay > 15.minutes
|
17
|
-
_enqueue(job, delay_seconds: delay)
|
17
|
+
_enqueue(job, nil, delay_seconds: delay)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def _enqueue(job, send_message_opts = {})
|
23
|
-
body
|
22
|
+
def _enqueue(job, body = nil, send_message_opts = {})
|
23
|
+
body ||= job.serialize
|
24
24
|
queue_url = Aws::Rails::SqsActiveJob.config.queue_url_for(job.queue_name)
|
25
25
|
send_message_opts[:queue_url] = queue_url
|
26
26
|
send_message_opts[:message_body] = Aws::Json.dump(body)
|
@@ -18,19 +18,22 @@ module ActiveJob
|
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def _enqueue(job, send_message_opts = {})
|
21
|
+
def _enqueue(job, body = nil, send_message_opts = {})
|
22
22
|
# FIFO jobs must be queued in order, so do not queue async
|
23
23
|
queue_url = Aws::Rails::SqsActiveJob.config.queue_url_for(job.queue_name)
|
24
24
|
if Aws::Rails::SqsActiveJob.fifo?(queue_url)
|
25
|
-
super(job, send_message_opts)
|
25
|
+
super(job, body, send_message_opts)
|
26
26
|
else
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
# Serialize is called here because the job’s locale needs to be
|
28
|
+
# determined in this thread and not in some other thread.
|
29
|
+
body = job.serialize
|
30
|
+
Concurrent::Promises
|
31
|
+
.future { super(job, body, send_message_opts) }
|
32
|
+
.rescue do |e|
|
33
|
+
Rails.logger.error "Failed to queue job #{job}. Reason: #{e}"
|
34
|
+
error_handler = Aws::Rails::SqsActiveJob.config.async_queue_error_handler
|
35
|
+
error_handler&.call(e, job, send_message_opts)
|
36
|
+
end
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
@@ -24,7 +24,7 @@ module Aws
|
|
24
24
|
|
25
25
|
# Only accept requests from this user agent if it is from localhost or a docker host in case of forgery.
|
26
26
|
unless request.local? || sent_from_docker_host?(request)
|
27
|
-
@logger.warn("SQSD request detected from untrusted address #{request.
|
27
|
+
@logger.warn("SQSD request detected from untrusted address #{request.ip}; returning 403 forbidden.")
|
28
28
|
return FORBIDDEN_RESPONSE
|
29
29
|
end
|
30
30
|
|
@@ -81,7 +81,7 @@ module Aws
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def sent_from_docker_host?(request)
|
84
|
-
app_runs_in_docker_container? && request.
|
84
|
+
app_runs_in_docker_container? && request.ip == '172.17.0.1'
|
85
85
|
end
|
86
86
|
|
87
87
|
def app_runs_in_docker_container?
|
@@ -26,7 +26,6 @@ module Aws
|
|
26
26
|
# @api private
|
27
27
|
DEFAULTS = {
|
28
28
|
max_messages: 10,
|
29
|
-
visibility_timeout: 120,
|
30
29
|
shutdown_timeout: 15,
|
31
30
|
queues: {},
|
32
31
|
logger: ::Rails.logger,
|
@@ -50,6 +49,8 @@ module Aws
|
|
50
49
|
# The max number of messages to poll for in a batch.
|
51
50
|
#
|
52
51
|
# @option options [Integer] :visibility_timeout
|
52
|
+
# If unset, the visibility timeout configured on the
|
53
|
+
# SQS queue will be used.
|
53
54
|
# The visibility timeout is the number of seconds
|
54
55
|
# that a message will not be processable by any other consumers.
|
55
56
|
# You should set this value to be longer than your expected job runtime
|
@@ -99,7 +100,7 @@ module Aws
|
|
99
100
|
job_queue = job_queue.to_sym
|
100
101
|
raise ArgumentError, "No queue defined for #{job_queue}" unless queues.key? job_queue
|
101
102
|
|
102
|
-
queues[job_queue
|
103
|
+
queues[job_queue]
|
103
104
|
end
|
104
105
|
|
105
106
|
# @api private
|
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.6.
|
4
|
+
version: 3.6.4
|
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: 2022-
|
11
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-record
|