fix(es-setup): retry docker pull on "i/o timeout" (#189988)

This commit is contained in:
Alejandro Fernández Haro 2024-08-06 19:29:40 +02:00 committed by GitHub
parent 1cb191fb69
commit d54fc70160
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -382,6 +382,12 @@ export async function maybeCreateDockerNetwork(log: ToolingLog) {
log.indent(-4);
}
const RETRYABLE_DOCKER_PULL_ERROR_MESSAGES = [
'connection refused',
'i/o timeout',
'Client.Timeout',
];
/**
*
* Pull a Docker image if needed. Ensures latest image.
@ -407,8 +413,12 @@ ${message}`;
{
retries: 2,
onFailedAttempt: (error) => {
// Only retry if `connection refused` is found in the error message.
if (!error?.message?.includes('connection refused')) {
// Only retry if retryable error messages are found in the error message.
if (
RETRYABLE_DOCKER_PULL_ERROR_MESSAGES.every(
(msg) => !error?.message?.includes('connection refused')
)
) {
throw error;
}
},