mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Co-authored-by: Spencer <email@spalger.com>
This commit is contained in:
parent
d7546941ee
commit
3d8906ad58
1 changed files with 12 additions and 3 deletions
|
@ -10,7 +10,7 @@ import { resolve } from 'path';
|
|||
import Fs from 'fs';
|
||||
|
||||
import * as Rx from 'rxjs';
|
||||
import { mergeMap, map, takeUntil, catchError } from 'rxjs/operators';
|
||||
import { mergeMap, map, takeUntil, catchError, ignoreElements } from 'rxjs/operators';
|
||||
import { Lifecycle } from '@kbn/test';
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
||||
import chromeDriver from 'chromedriver';
|
||||
|
@ -53,6 +53,8 @@ const chromiumUserPrefs = {
|
|||
},
|
||||
};
|
||||
|
||||
const sleep$ = (ms: number) => Rx.timer(ms).pipe(ignoreElements());
|
||||
|
||||
/**
|
||||
* Best we can tell WebDriver locks up sometimes when we send too many
|
||||
* commands at once, sometimes... It causes random lockups where we never
|
||||
|
@ -331,6 +333,7 @@ export async function initWebDriver(
|
|||
edgePaths = await installDriver();
|
||||
}
|
||||
|
||||
let attempt = 1;
|
||||
return await Rx.race(
|
||||
Rx.timer(2 * MINUTE).pipe(
|
||||
map(() => {
|
||||
|
@ -355,8 +358,14 @@ export async function initWebDriver(
|
|||
catchError((error, resubscribe) => {
|
||||
log.warning('Failure while creating webdriver instance');
|
||||
log.warning(error);
|
||||
log.warning('...retrying...');
|
||||
return resubscribe;
|
||||
|
||||
if (attempt > 5) {
|
||||
throw new Error('out of retry attempts');
|
||||
}
|
||||
|
||||
attempt += 1;
|
||||
log.warning('...retrying in 15 seconds...');
|
||||
return Rx.concat(sleep$(15000), resubscribe);
|
||||
})
|
||||
)
|
||||
).toPromise();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue