aws-sdk-rails 3.12.0 → 3.13.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: 4db4f6778275cb1b836119e1d593fa7d9ebc2e629bbe4818685fdc36dffa286f
4
- data.tar.gz: 567aed0fd65308e3e1ab9df0875d2d5d3dbbe2b2228d4756dbc55edbf84e481e
3
+ metadata.gz: 43528604142d01e2ddcddf37ae598a08c11744aa3a9ccc6757dbc7d1932d3546
4
+ data.tar.gz: 7977e087f6372fc8326193dad744f908cda1d2174fc6f817e9cfe48b286a5cfb
5
5
  SHA512:
6
- metadata.gz: 56b130425e1fcd11fd2cbcb41a8bc0159c02cc2ae821a8c95cd8553cfb3bfb63492cffaed8205e2cbd142272eb5ee6351e31a143ec12259c2ac226f511f0aec4
7
- data.tar.gz: e5db0e0c8a1e955a12ca48e57e6d2d64f4758a083cb2d9a28eec4b7c45ef6eed5084543f63b2f4714cd5ca797a16c160172fab0e61b201119205a3eef7e95a79
6
+ metadata.gz: 2ceda136ba4f7077b6608787528f2ae97b9ceb3169d9c67f101105e7e512dc8000cdb3bf09e5f96b786544bdb427eb15cc0df6571ecc544f5b1603c51cc034b8
7
+ data.tar.gz: 1fdb53b5fdc4a752643deb9e360988983ad939cce6ada4a8ce3bc68122959c44c7ca6f98d55987172c4d559d9d010ec652b482576bf12b4e496193b183aa236e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.12.0
1
+ 3.13.0
@@ -20,13 +20,13 @@ module ActiveJob
20
20
  # FIFO jobs must be queued in order, so do not queue async
21
21
  queue_url = Aws::Rails::SqsActiveJob.config.queue_url_for(job.queue_name)
22
22
  if Aws::Rails::SqsActiveJob.fifo?(queue_url)
23
- super(job, body, send_message_opts)
23
+ super
24
24
  else
25
25
  # Serialize is called here because the job’s locale needs to be
26
26
  # determined in this thread and not in some other thread.
27
27
  body = job.serialize
28
28
  Concurrent::Promises
29
- .future { super(job, body, send_message_opts) }
29
+ .future { super }
30
30
  .rescue do |e|
31
31
  Rails.logger.error "Failed to queue job #{job}. Reason: #{e}"
32
32
  error_handler = Aws::Rails::SqsActiveJob.config.async_queue_error_handler
@@ -9,20 +9,44 @@ module Aws
9
9
  class Executor
10
10
  DEFAULTS = {
11
11
  min_threads: 0,
12
- max_threads: Concurrent.processor_count,
12
+ max_threads: Integer(Concurrent.available_processor_count || Concurrent.processor_count),
13
13
  auto_terminate: true,
14
14
  idletime: 60, # 1 minute
15
- fallback_policy: :caller_runs # slow down the producer thread
16
- # TODO: Consider catching the exception and sleeping instead of using :caller_runs
15
+ fallback_policy: :abort # Concurrent::RejectedExecutionError must be handled
17
16
  }.freeze
18
17
 
19
18
  def initialize(options = {})
20
19
  @executor = Concurrent::ThreadPoolExecutor.new(DEFAULTS.merge(options))
21
20
  @retry_standard_errors = options[:retry_standard_errors]
22
21
  @logger = options[:logger] || ActiveSupport::Logger.new($stdout)
22
+ @task_complete = Concurrent::Event.new
23
23
  end
24
24
 
25
25
  def execute(message)
26
+ post_task(message)
27
+ rescue Concurrent::RejectedExecutionError
28
+ # no capacity, wait for a task to complete
29
+ @task_complete.reset
30
+ @task_complete.wait
31
+ retry
32
+ end
33
+
34
+ def shutdown(timeout = nil)
35
+ @executor.shutdown
36
+ clean_shutdown = @executor.wait_for_termination(timeout)
37
+ if clean_shutdown
38
+ @logger.info 'Clean shutdown complete. All executing jobs finished.'
39
+ else
40
+ @logger.info "Timeout (#{timeout}) exceeded. Some jobs may not have " \
41
+ 'finished cleanly. Unfinished jobs will not be removed from ' \
42
+ 'the queue and can be ru-run once their visibility timeout ' \
43
+ 'passes.'
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def post_task(message)
26
50
  @executor.post(message) do |message|
27
51
  job = JobRunner.new(message)
28
52
  @logger.info("Running job: #{job.id}[#{job.class_name}]")
@@ -43,19 +67,8 @@ module Aws
43
67
  else
44
68
  message.delete
45
69
  end
46
- end
47
- end
48
-
49
- def shutdown(timeout = nil)
50
- @executor.shutdown
51
- clean_shutdown = @executor.wait_for_termination(timeout)
52
- if clean_shutdown
53
- @logger.info 'Clean shutdown complete. All executing jobs finished.'
54
- else
55
- @logger.info "Timeout (#{timeout}) exceeded. Some jobs may not have " \
56
- 'finished cleanly. Unfinished jobs will not be removed from ' \
57
- 'the queue and can be ru-run once their visibility timeout ' \
58
- 'passes.'
70
+ ensure
71
+ @task_complete.set
59
72
  end
60
73
  end
61
74
  end
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.12.0
4
+ version: 3.13.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-04-02 00:00:00.000000000 Z
11
+ date: 2024-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-record
@@ -102,16 +102,16 @@ dependencies:
102
102
  name: concurrent-ruby
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - "~>"
105
+ - - ">="
106
106
  - !ruby/object:Gem::Version
107
- version: '1'
107
+ version: 1.3.1
108
108
  type: :runtime
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - "~>"
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: '1'
114
+ version: 1.3.1
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: railties
117
117
  requirement: !ruby/object:Gem::Requirement
@@ -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.22
201
+ rubygems_version: 3.5.5
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: AWS SDK for Ruby on Rails Plugin