mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
force timeout, logs indicate that pings are getting stuck (#12251)
* force timeout, logs indicate that pings are getting stuck (cherry picked from commit ff6a71819be272253d969a0be681dc9749a0f00d) * actually reject the promise
This commit is contained in:
parent
6c835afcde
commit
fe1ca5d399
1 changed files with 6 additions and 1 deletions
|
@ -3,7 +3,12 @@ import { fromNode as fcb } from 'bluebird';
|
|||
|
||||
export async function ping(url) {
|
||||
try {
|
||||
await fcb(cb => request({ url, timeout: 1000 }, cb));
|
||||
await Promise.race([
|
||||
fcb(cb => request(url, cb)),
|
||||
new Promise((resolve, reject) => {
|
||||
setTimeout(() => reject(new Error('timeout')), 1000);
|
||||
})
|
||||
]);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue