Summary
registerApp can continue its polling loop after its AbortSignal has been aborted when a poll request is already in flight.
Affected version
@larksuiteoapi/node-sdk 1.73.0
main at f54b49f3566c52b54c598194b7ed3015e3e24224
Reproduction
Using Jest fake timers and a mocked httpInstance.post:
- Return a normal
begin response.
- Return
authorization_pending for the first poll so another poll is scheduled.
- Advance the timer and leave the second poll request pending.
- Abort the supplied controller. The
registerApp promise correctly rejects with abort.
- Resolve the already-pending request with another
authorization_pending response and advance timers again.
The mock receives a third poll request even though registration has already been aborted.
Expected behavior
After cancellation, no in-flight completion should schedule another poll or emit further status transitions.
Actual behavior
The abort handler clears the timers and rejects the outer promise, but poll() does not track a settled/aborted state. After its awaited request resolves, it executes the normal response path and assigns a new setTimeout(poll, interval).
Impact
Cancelled registration can continue generating network requests and callbacks until a later terminal response or expiry. This can retain resources and produce activity after the caller has already handled cancellation.
Summary
registerAppcan continue its polling loop after itsAbortSignalhas been aborted when a poll request is already in flight.Affected version
@larksuiteoapi/node-sdk1.73.0mainatf54b49f3566c52b54c598194b7ed3015e3e24224Reproduction
Using Jest fake timers and a mocked
httpInstance.post:beginresponse.authorization_pendingfor the first poll so another poll is scheduled.registerApppromise correctly rejects withabort.authorization_pendingresponse and advance timers again.The mock receives a third poll request even though registration has already been aborted.
Expected behavior
After cancellation, no in-flight completion should schedule another poll or emit further status transitions.
Actual behavior
The abort handler clears the timers and rejects the outer promise, but
poll()does not track a settled/aborted state. After its awaited request resolves, it executes the normal response path and assigns a newsetTimeout(poll, interval).Impact
Cancelled registration can continue generating network requests and callbacks until a later terminal response or expiry. This can retain resources and produce activity after the caller has already handled cancellation.