You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: Allow QueuePoller to be interrupted from another thread #2855
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.
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.
Activity
alextwoods commentedon May 15, 2023
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.