Skip to content

Remove the signal.onabort listener when finished #71

@gotham8x

Description

@gotham8x

The abort event listener is currently not removed when the task finished (without any abort). It leads to the following warning:

(node:1852) MaxListenersExceededWarning: Possible EventTarget memory leak detected.
71 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit

https://github.com/sindresorhus/p-retry/blob/285fdc3f890a6f3d199b3d4abb0bad7c172c2233/index.js#L86C52-L94

As a best practice, the one who added the event listener to also be responsible for removing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions