-
Notifications
You must be signed in to change notification settings - Fork 62
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
Conversation
sample-app/Gemfile
Outdated
@@ -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: "../" |
There was a problem hiding this comment.
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.
sample-app/app/jobs/test_job.rb
Outdated
@@ -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] |
There was a problem hiding this comment.
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.
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.