Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Flush after updating all products, not after updating each of the pro…
Browse files Browse the repository at this point in the history
…ducts

Flushing is an expensive operation so we should run it carefully
  • Loading branch information
albarin committed Nov 28, 2023
1 parent fd7efc7 commit 53d3d9c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion src/Patterns/ProductUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ public function update_product_content( $ai_generated_product_content ) {
),
)
);
flush_rewrite_rules();

require_once ABSPATH . 'wp-admin/includes/media.php';
require_once ABSPATH . 'wp-admin/includes/file.php';
Expand Down
1 change: 1 addition & 0 deletions src/StoreApi/Routes/V1/AI/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ protected function get_route_post_response( \WP_REST_Request $request ) {
}

$product_updater->update_product_content( $product_information );
flush_rewrite_rules();

return rest_ensure_response(
array(
Expand Down

0 comments on commit 53d3d9c

Please sign in to comment.