Skip to content

registerApp continues polling after its AbortSignal is aborted during a request #211

Description

@dajiaohuang

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:

  1. Return a normal begin response.
  2. Return authorization_pending for the first poll so another poll is scheduled.
  3. Advance the timer and leave the second poll request pending.
  4. Abort the supplied controller. The registerApp promise correctly rejects with abort.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions