discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

feat(SH): Support abort signal on SequentialHandler

Open JPBM135 opened this issue 3 years ago • 1 comments
trafficstars

Which package is the feature request for?

rest

Feature

As discussed on Discord, the @sapphire/async-queue now supports AbortSignal to dequeue requests, this feature should be implemented on the RequestManager so it can be passed to each queue.

Ideal solution or implementation

I suggest adding an field for the RequestManager to allow the client to pass his own AbortSignal. Also I think the ability to abort only some type of request is useful, so maybe one AbortSignal per hander or per route?

Alternative solutions or implementations

No response

Other context

https://discord.com/channels/222078108977594368/1005495514248257648/1005601214228082810

https://github.com/sapphiredev/utilities/commit/c0629e781ebc3f48e496a0851191b32e91f62fe9

https://github.com/sapphiredev/utilities/pull/417

JPBM135 avatar Aug 16 '22 11:08 JPBM135

Opened https://github.com/sapphiredev/utilities/pull/429 to support aborting the entire queue. Mind you, there's no way to abort the head since it's already processing (and the promise it holds is resolved), so remaining will always be 1 at most after calling abortAll(). I added queued too which represents the count sans the head.

Edit: it's already released https://github.com/sapphiredev/utilities/releases/tag/@sapphire%[email protected]

kyranet avatar Aug 16 '22 20:08 kyranet