aws-sdk-rails 3.6.0 → 3.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/action_dispatch/session/dynamodb_store.rb +5 -1
- data/lib/active_job/queue_adapters/amazon_sqs_adapter.rb +11 -9
- 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/railtie.rb +1 -4
- data/lib/aws/rails/sqs_active_job/configuration.rb +3 -2
- data/lib/aws/rails/sqs_active_job/poller.rb +0 -1
- data/lib/generators/aws_record/model/model_generator.rb +2 -2
- data/lib/generators/aws_record/model/templates/{model.rb → model.erb} +0 -0
- data/lib/generators/aws_record/model/templates/{table_config.rb → table_config.erb} +0 -0
- data/lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb +1 -1
- data/lib/generators/dynamo_db/session_store_migration/templates/{session_store_migration.rb → session_store_migration.erb} +0 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02dc930917c099420e224d5193b65a406ed2b8fa5f7a082515f692e99c06f421
|
4
|
+
data.tar.gz: b37670c127021772d0f2e76b4ac3a0ce4a0b35c112c1f9eed21b8c30ca981b00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496f7fe7c27beebd9cd99e5eac7e785ba197cf8913bc28bc60511192fb32caf7b9fa6caa088a0ea75eae7824a468256688d3060f8176efd0c1fa2962611c06a9
|
7
|
+
data.tar.gz: 366e891aea46c737de15b2b58b5b593a980a277b0c2c20c87e28b8b9be446ce5a906e3f1f445bbcf0a63cc8332702d851d97d90c9db31c45fbc82e07d3186a67
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.6.
|
1
|
+
3.6.3
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'aws-sessionstore-dynamodb'
|
2
|
+
require 'action_dispatch/middleware/session/abstract_store'
|
2
3
|
|
3
4
|
module ActionDispatch
|
4
5
|
module Session
|
@@ -9,11 +10,14 @@ module ActionDispatch
|
|
9
10
|
# This class will use the Rails secret_key_base unless otherwise provided.
|
10
11
|
#
|
11
12
|
# Configuration can also be provided in YAML files from Rails config, either
|
12
|
-
# in "config/session_store.yml" or "config/session_store
|
13
|
+
# in "config/session_store.yml" or "config/session_store/#\\{Rails.env}.yml".
|
13
14
|
# Configuration files that are environment-specific will take precedence.
|
14
15
|
#
|
15
16
|
# @see https://docs.aws.amazon.com/sdk-for-ruby/aws-sessionstore-dynamodb/api/Aws/SessionStore/DynamoDB/Configuration.html
|
16
17
|
class DynamodbStore < Aws::SessionStore::DynamoDB::RackMiddleware
|
18
|
+
include StaleSessionCheck
|
19
|
+
include SessionObject
|
20
|
+
|
17
21
|
def initialize(app, options = {})
|
18
22
|
options[:config_file] ||= config_file if config_file.exist?
|
19
23
|
options[:secret_key] ||= Rails.application.secret_key_base
|
@@ -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)
|
@@ -30,13 +30,15 @@ module ActiveJob
|
|
30
30
|
# job_id is unique per initialization of job
|
31
31
|
# Remove it from message dup id to ensure run-once behavior
|
32
32
|
# with ActiveJob retries
|
33
|
-
|
34
|
-
|
35
|
-
Aws::Json.dump(body.except('job_id'))
|
36
|
-
)
|
33
|
+
send_message_opts[:message_deduplication_id] =
|
34
|
+
Digest::SHA256.hexdigest(Aws::Json.dump(body.except('job_id')))
|
37
35
|
|
38
|
-
|
36
|
+
message_group_id = job.message_group_id if job.respond_to?(:message_group_id)
|
37
|
+
message_group_id ||= Aws::Rails::SqsActiveJob.config.message_group_id
|
38
|
+
|
39
|
+
send_message_opts[:message_group_id] = message_group_id
|
39
40
|
end
|
41
|
+
|
40
42
|
Aws::Rails::SqsActiveJob.config.client.send_message(send_message_opts)
|
41
43
|
end
|
42
44
|
|
@@ -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
|
@@ -11,7 +11,7 @@ module Aws
|
|
11
11
|
|
12
12
|
def initialize(app)
|
13
13
|
@app = app
|
14
|
-
@logger =
|
14
|
+
@logger = ::Rails.logger
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(env)
|
@@ -20,7 +20,7 @@ module Aws
|
|
20
20
|
# Pass through unless user agent is the SQS Daemon
|
21
21
|
return @app.call(env) unless from_sqs_daemon?(request)
|
22
22
|
|
23
|
-
@logger.debug('aws-rails
|
23
|
+
@logger.debug('aws-sdk-rails middleware detected call from Elastic Beanstalk SQS Daemon.')
|
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)
|
data/lib/aws/rails/railtie.rb
CHANGED
@@ -48,10 +48,7 @@ module Aws
|
|
48
48
|
aws_credential_keys = %i[access_key_id secret_access_key session_token]
|
49
49
|
|
50
50
|
Aws.config.merge!(
|
51
|
-
::Rails.application
|
52
|
-
.try(:credentials)
|
53
|
-
.try(:aws)
|
54
|
-
.to_h.slice(*aws_credential_keys)
|
51
|
+
::Rails.application.credentials[:aws].to_h.slice(*aws_credential_keys)
|
55
52
|
)
|
56
53
|
end
|
57
54
|
|
@@ -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
|
@@ -9,11 +9,11 @@ module AwsRecord
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create_model
|
12
|
-
template "model.
|
12
|
+
template "model.erb", File.join("app/models", class_path, "#{file_name}.rb")
|
13
13
|
end
|
14
14
|
|
15
15
|
def create_table_config
|
16
|
-
template "table_config.
|
16
|
+
template "table_config.erb", File.join("db/table_config", class_path, "#{file_name}_config.rb") if options["table_config"]
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
File without changes
|
File without changes
|
File without changes
|
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.3
|
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:
|
11
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-record
|
@@ -136,13 +136,13 @@ files:
|
|
136
136
|
- lib/generators/aws_record/generated_attribute.rb
|
137
137
|
- lib/generators/aws_record/model/USAGE
|
138
138
|
- lib/generators/aws_record/model/model_generator.rb
|
139
|
-
- lib/generators/aws_record/model/templates/model.
|
140
|
-
- lib/generators/aws_record/model/templates/table_config.
|
139
|
+
- lib/generators/aws_record/model/templates/model.erb
|
140
|
+
- lib/generators/aws_record/model/templates/table_config.erb
|
141
141
|
- lib/generators/aws_record/secondary_index.rb
|
142
142
|
- lib/generators/dynamo_db/session_store_migration/USAGE
|
143
143
|
- lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb
|
144
144
|
- lib/generators/dynamo_db/session_store_migration/templates/dynamo_db_session_store.yml
|
145
|
-
- lib/generators/dynamo_db/session_store_migration/templates/session_store_migration.
|
145
|
+
- lib/generators/dynamo_db/session_store_migration/templates/session_store_migration.erb
|
146
146
|
- lib/tasks/aws_record/migrate.rake
|
147
147
|
- lib/tasks/dynamo_db/session_store.rake
|
148
148
|
homepage: https://github.com/aws/aws-sdk-rails
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
167
|
+
rubygems_version: 3.2.26
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: AWS SDK for Ruby on Rails Plugin
|