mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.18`: - [[scout] Don't mix `await` with promise callbacks (#211905)](https://github.com/elastic/kibana/pull/211905) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"David Olaru","email":"dolaru@elastic.co"},"sourceCommit":{"committedDate":"2025-02-20T15:05:17Z","message":"[scout] Don't mix `await` with promise callbacks (#211905)\n\n## Summary\n\nThere's a high likelihood that this causes some unwanted behavior where\nthe promise is not resolved and the `node` process just exists without\nany error.","sha":"1147bb65dd655d9dac42f866c61eb23af42d2d74","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[scout] Don't mix `await` with promise callbacks","number":211905,"url":"https://github.com/elastic/kibana/pull/211905","mergeCommit":{"message":"[scout] Don't mix `await` with promise callbacks (#211905)\n\n## Summary\n\nThere's a high likelihood that this causes some unwanted behavior where\nthe promise is not resolved and the `node` process just exists without\nany error.","sha":"1147bb65dd655d9dac42f866c61eb23af42d2d74"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211905","number":211905,"mergeCommit":{"message":"[scout] Don't mix `await` with promise callbacks (#211905)\n\n## Summary\n\nThere's a high likelihood that this causes some unwanted behavior where\nthe promise is not resolved and the `node` process just exists without\nany error.","sha":"1147bb65dd655d9dac42f866c61eb23af42d2d74"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: David Olaru <dolaru@elastic.co>
This commit is contained in:
parent
729029ddc9
commit
bdeda8a477
1 changed files with 8 additions and 10 deletions
|
@ -30,17 +30,15 @@ export async function getValidatedESClient(
|
|||
const { log, cli = false } = helperSettings;
|
||||
const es = new ESClient(esClientOptions);
|
||||
|
||||
await es.info().then(
|
||||
(esInfo) => {
|
||||
if (log !== undefined) {
|
||||
log.info(`Connected to Elasticsearch node '${esInfo.name}'`);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
const msg = `Failed to connect to Elasticsearch\n${err}`;
|
||||
throw cli ? createFailError(msg) : Error(msg);
|
||||
try {
|
||||
const esInfo = await es.info();
|
||||
if (log !== undefined) {
|
||||
log.info(`Connected to Elasticsearch node '${esInfo.name}'`);
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
const msg = `Failed to connect to Elasticsearch\n${err}`;
|
||||
throw cli ? createFailError(msg) : Error(msg);
|
||||
}
|
||||
|
||||
return es;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue