Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 5 retries for wp core download #218

Merged
merged 1 commit into from Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/WordPress.php
Expand Up @@ -497,7 +497,7 @@ private function enable_page_cache() {
\EE_DOCKER::docker_compose_exec( "wp config set WP_CACHE_KEY_SALT $obj_cache_key_prefix --add=true --type=constant", 'php', 'bash', 'www-data' );
\EE_DOCKER::docker_compose_exec( "wp config set WP_REDIS_MAXTTL 14400 --add=true --type=constant", 'php', 'bash', 'www-data' );
\EE_DOCKER::docker_compose_exec( "wp $wp_cli_params rt_wp_nginx_helper_options '$plugin_data' --format=json", 'php', 'bash', 'www-data' );

}

/**
Expand Down Expand Up @@ -1109,8 +1109,18 @@ private function wp_download_and_config( $assoc_args ) {
$wp_download_path = $this->site_data['site_container_fs_path'];
$core_download_command = "wp core download --path=$wp_download_path --locale='$this->locale' $core_download_arguments";

if ( ! \EE_DOCKER::docker_compose_exec( $core_download_command, 'php', 'bash', 'www-data' ) ) {
\EE::error( 'Unable to download wp core.', false );
$retry = 0;

while ( $retry < 5 ) {
if ( ! \EE_DOCKER::docker_compose_exec( $core_download_command, 'php', 'bash', 'www-data' ) ) {
if ( $retry++ < 5 ) {
\EE::log( 'Unable to download wp core. Retrying...' );
continue;
}
\EE::error( 'Unable to download wp core.', false );
} else {
break;
}
}

if ( 'db' === $this->site_data['db_host'] ) {
Expand Down