Feature: Allow QueuePoller to be interrupted from another thread
- Dominant language
- Ruby
- Stars
- 3.7k
- Forks
- 1.2k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Description
### 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
- [X] 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
Contributor guide
Assessment
This issue has not been assessed yet.