Allow passing in a signal to abort a cluster client request#37563
Allow passing in a signal to abort a cluster client request#37563lukasolson merged 4 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-platform |
💔 Build Failed |
0ccd052 to
812b644
Compare
There was a problem hiding this comment.
Not a requirement, but if you want to achieve this without mutating signal and therefore options, you can use:
options.signal.addEventListener('abort', () => request.abort());There was a problem hiding this comment.
Instead of testing the AbortSignal itself, can we call abort and ensure the call fails?
💔 Build Failed |
812b644 to
40cfb39
Compare
|
@eliperelman Could you give this another look? |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
* Allow passing in a signal to abort an Elasticsearch request using the cluster client
* Go back to using promises (which still return abort method) and update test
* Update docs
* Explicitly return Promise<any> instead of {}
|
7.x (7.3.0): 6ca6b1a |
💚 Build Succeeded |
|
@lukasolson I've started seeing the following error on master and traced it back to here: There are obviously some auth issues but the thing that makes the server crash is the |
|
Hmm, the object returned from calling the Elasticsearch JS client should always be returning something with an |
|
@lukasolson Turns out this is caused by the APM node agent: #52617. |

Resolves #37359.
This PR provides an additional optional option to the
CallAPIoptions,signal, which represents a signal from anAbortControllerobject. If provided, thencontroller.abortis invoked, then the request to ES itself will also be aborted.Dev Docs
callWithRequestnow accepts a AbortController signal for aborting requests to Elasticsearch. Example usage: