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
Merged

Conversation

alextwoods
Copy link
Contributor

@alextwoods alextwoods commented Dec 3, 2024

Issue #, if available:
#167

Description of changes:
Adds new ENV configuration to opt-in to async job processing in EBS SQSD middleware.

Async job processing is done using a thread pool executor. When there is capacity, the job is queued and a 200 OK is returned immediately. When there is no capacity, the middleware returns a 429 (too many requests) which will cause the SQSD to NOT delete the message, leaving it in the queue for future processing.

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.

@alextwoods alextwoods requested a review from mullermp December 3, 2024 20:02
@alextwoods alextwoods marked this pull request as ready for review December 3, 2024 21:51
.github/workflows/ci.yml Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
lib/aws/rails/middleware/elastic_beanstalk_sqsd.rb Outdated Show resolved Hide resolved
lib/aws/rails/middleware/elastic_beanstalk_sqsd.rb Outdated Show resolved Hide resolved
@@ -2,7 +2,7 @@ source "https://rubygems.org"

# Our gems
# bundle config set local.aws-sdk-rails ../
gem 'aws-sdk-rails', git: 'https://github.com/aws/aws-sdk-rails', branch: 'main'
gem 'aws-sdk-rails', path: "../"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to change this back - you can set the branch and use bundler config local.

@@ -4,5 +4,8 @@ class TestJob < ApplicationJob

def perform(*args)
puts "Job performed with args: #{args}"
if args[0].is_a?(Hash) && args[0][:error]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not necessary, or if you want to keep, maybe a TestErrorJob or also place this code in async.

@alextwoods alextwoods merged commit faf8961 into main Dec 5, 2024
13 of 15 checks passed
@alextwoods alextwoods deleted the ebs_sqsd branch December 5, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants