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

Allow consumers stopped with abort: true to be restarted #429

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

adamrensel-artera
Copy link
Contributor

@adamrensel-artera adamrensel-artera commented Oct 13, 2023

Resolves #389

Description:
This bug was originally closed, but I've been running into a related issue. Basically we want to start and stop a consumer based on a feature flag while using the abort option on .stop. The singleton AbortController makes it impossible to restart an aborted consumer, even if the consumer is recreated. This results in the abort signal persisting and being sent into any following AWS SDK calls.

This PR creates a new AbortController each time the consumer is started, which results in a fresh abort signal and allows the consumer to restart. I've also removed the previous controller.ts file as it's no longer used.

I've also added an associated test that fails without these changes that demonstrates how the abort signal is being passed to the AWS SDK .send method. Thanks!

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Why is this change required?:
A simple explanation of what the problem is and how this PR solves it

Code changes:

  • A bullet point list of key code changes that have been made.
  • When describing code changes, try to communicate how and why you implemented something a specific way, not just what has changed.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions
Copy link

github-actions bot commented Oct 13, 2023

CLA Assistant Lite bot CLA CHECK All Contributors have signed the CLA

@adamrensel-artera
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@adamrensel-artera
Copy link
Contributor Author

recheck

@adamrensel-artera adamrensel-artera changed the title Create a new AbortController each time the consumer starts Allow consumers stopped with abort: true to be restarted Oct 13, 2023
@nicholasgriffintn
Copy link
Member

Thanks for the PR, it's appreciated, I'll take a look at this by Monday.

@codeclimate
Copy link

codeclimate bot commented Oct 13, 2023

Code Climate has analyzed commit 3926fb6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 96.9% (0.0% change).

View more on Code Climate.

Copy link
Member

@nicholasgriffintn nicholasgriffintn left a comment

Choose a reason for hiding this comment

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

This seems about right to me.

@nicholasgriffintn nicholasgriffintn merged commit e120eeb into bbc:main Oct 16, 2023
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2023
@nicholasgriffintn
Copy link
Member

Released as v7.4.0-canary.0, we'll be testing that version and then release it as 7.4.0 once we're happy with the changes.

@adamrensel-artera adamrensel-artera deleted the reset-abort-on-start branch October 18, 2023 15:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: abort: true raises errors when AWS SQS is polling for messages
2 participants