Closed nicholasgriffintn closed 1 year ago
The PR is still in for this and it is ready to go, if we drop Node 14 support or add a polyfill to this library.
At the moment, I'm leaning towards dropping support for Node 14, the security support for that version will end on 30 Apr 2023 so there are other reasons that we should do this, and this would be more valuable than spending time and future resource on a Polyfill.
I've raised an issue for this here: https://github.com/bbc/sqs-consumer/issues/362
Problem
There have been a number of requests that sqs-consumer should abort any existing requests when
.stop()
is called, as in some implementations this is expected behaviour.Solution
In order to support existing implementations, sqs-consumer should provide new functionality that also aborts existing requests when
.stop()
is called.The suggested solution would be to add an option to the stop function that will allow users to tell us to abort any requests to AWS SQS, this would be implemented like so:
consumer.stop({abort: true})
To support backwards compatibility, this option would default to
false
.If the option is true, we should implement and use the AbortController to abort SQS requests as discussed here:
https://aws.amazon.com/blogs/developer/abortcontroller-in-modular-aws-sdk-for-javascript/
More documentation is also available here:
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sqs/interfaces/abortcontroller.html
I don't know if we will use the aws-sdk for this though, as it would require an additional dependency that people would have to add. We can potentially use the Node implementation instead:
https://nodejs.org/api/globals.html#globals_class_abortcontroller