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

Feature: Allow QueuePoller to be interrupted from another thread #2855

Open
1 of 2 tasks
camsteffen opened this issue May 12, 2023 · 1 comment
Open
1 of 2 tasks

Feature: Allow QueuePoller to be interrupted from another thread #2855

camsteffen opened this issue May 12, 2023 · 1 comment
Labels
feature-request A feature should be added or improved. help wanted We are asking the community to submit a PR to resolve this issue. p3 This is a minor priority issue

Comments

@camsteffen
Copy link

Describe the feature

There should be a way to cleanly stop/interrupt QueuePoller from another thread. It should immediately abort pending poll requests, but if the poll callback is executing, it should wait for that to complete before returning.

Use Case

I would to write code like Signal.trap("INT") { poller.stop }, so that I may use Ctrl+C to interrupt a daemon script that is polling SQS with QueuePoller.

Proposed Solution

The QueuePoller could have a method stop that can be invoked from any thread. If a call to poll is awaiting an SQS poll request, the request will be immediately aborted and poll will return normally. If poll is executing the callback when stop is invoked, then it will wait until the callback returns and then poll will return without making further poll requests.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

3.1.0

Environment details (OS name and version, etc.)

macOS

@camsteffen camsteffen added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 12, 2023
@alextwoods alextwoods added help wanted We are asking the community to submit a PR to resolve this issue. and removed needs-triage This issue or PR still needs to be triaged. labels May 15, 2023
@alextwoods
Copy link
Contributor

Thanks for submitting this - this seems like a useful feature that we would consider. I think the slightly difficult part is "immediately abort pending poll". By default the settings will use SQS Long polling and we'd need a way to manage stopping that. Do you have any proposed solutions for that? We would be willing to review a demo PR (and merge a full PR for the feature) if you have ideas for implementing this.

@RanVaknin RanVaknin added the p3 This is a minor priority issue label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. help wanted We are asking the community to submit a PR to resolve this issue. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

3 participants