Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use an AbortSignal for per-request timeouts #96

Merged
merged 1 commit into from
May 21, 2024
Merged

Commits on May 1, 2024

  1. fix: Use an AbortSignal for per-request timeouts

    A potential fix for
    #63, largely
    inspired by a community member's PR that was never merged:
    #55
    
    According to an Undici core committer in this comment
    elastic/elasticsearch-js#1716 (comment)
    the issue that triggers the MaxListenersExceededWarning, and possibly a
    memory leak in some cases, is caused by attaching an EventEmitter to
    each request by default when a per-request timeout is set, rather than
    attaching an AbortSignal.
    
    My assumption is that an EventEmitter was used because AbortSignal and
    AbortController were not added to Node.js until v14.17.0, so we couldn't
    guarantee v14 users would have it. I'm not certain why using
    EventEmitters makes a difference memory-wise, but it does get rid of the
    MaxListenersExceededWarning.
    JoshMock committed May 1, 2024
    Configuration menu
    Copy the full SHA
    b006b9a View commit details
    Browse the repository at this point in the history