[HPOS CLI] Flush in-memory cache after each batch in migration (#44670)

This commit is contained in:
Jorge A. Torres 2024-03-08 06:47:27 -05:00 committed by GitHub
parent 1c9620b3be
commit 0da0e372d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: performance
Improve memory usage in HPOS sync CLI tool.

View File

@ -219,6 +219,12 @@ class CLIRunner {
$orders_remaining = count( $this->synchronizer->get_next_batch_to_process( 1 ) ) > 0;
$order_count = $remaining_count - $batch_size;
if ( function_exists( 'wp_cache_supports' ) && wp_cache_supports( 'flush_runtime' ) ) {
wp_cache_flush_runtime();
}
$GLOBALS['wpdb']->flush();
}
$progress->finish();