Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support async job processing in EBS SQSD middleware #168

Merged
merged 12 commits into from
Dec 5, 2024
Prev Previous commit
Next Next commit
Bust cache
alextwoods committed Dec 4, 2024
commit 75982f531457823637dbca6dcf27d472d404a71c
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
cache-version: 0912834390128

- name: Test
run: bundle exec rake spec
8 changes: 4 additions & 4 deletions lib/aws/rails/middleware/elastic_beanstalk_sqsd.rb
Original file line number Diff line number Diff line change
@@ -42,14 +42,14 @@ def shutdown(timeout = nil)
private

def init_executor
threads = Integer(ENV.fetch('AWS_PROCESS_BEANSTALK_WORKER_THREADS',
Concurrent.available_processor_count || Concurrent.processor_count))
puts "Running with threads: #{threads}"
options = {
max_threads: Integer(Concurrent.available_processor_count || Concurrent.processor_count),
max_threads: threads,
max_queue: 1,
fallback_policy: :abort # Concurrent::RejectedExecutionError must be handled
}
if ENV['AWS_PROCESS_BEANSTALK_WORKER_THREADS']
options[:max_threads] = Integer(ENV['AWS_PROCESS_BEANSTALK_WORKER_THREADS'])
end
@executor = Concurrent::ThreadPoolExecutor.new(options)
at_exit { shutdown }
end