mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
(cherry picked from commit df6d386d50
)
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
This commit is contained in:
parent
708e1ba32e
commit
88a3d35f7b
1 changed files with 5 additions and 2 deletions
|
@ -12,6 +12,8 @@ import fetch from 'node-fetch';
|
|||
|
||||
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
const DOCKER_START_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
||||
|
||||
export function useDockerRegistry() {
|
||||
const packageRegistryPort = process.env.FLEET_PACKAGE_REGISTRY_PORT || '8081';
|
||||
|
||||
|
@ -32,8 +34,9 @@ export function useDockerRegistry() {
|
|||
isExited = true;
|
||||
});
|
||||
|
||||
let retries = 0;
|
||||
while (!isExited && retries++ <= 20) {
|
||||
const startedAt = Date.now();
|
||||
|
||||
while (!isExited && Date.now() - startedAt <= DOCKER_START_TIMEOUT) {
|
||||
try {
|
||||
const res = await fetch(`http://localhost:${packageRegistryPort}/`);
|
||||
if (res.status === 200) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue