Browser issue during use of woocommerce API

Question

I have created a php page that updates a woocommerce catalog, using both the woocommerce API and the wordpress snippets (wp_update_posts etc).

If I process 5 articles at a time, everything works fine. Opening the browser I quickly arrive at the end of the procedure.

If I process 50 articles the browser waits and, despite the articles being processed, after some time it tries to request the page again. This way, when I open the page, I actually launch multiple processes, without one waiting for the other to finish.

It is as if the browser is waiting for a response.

How can I solve? Maybe I need to send some headers?

My application top:

define('WP_USE_THEMES', false);
//require('../wp-load.php');
require_once('../wp-config.php');
if ( ! function_exists( 'download_url' ) ) {
    require_once  '../wp-admin/includes/file.php';
}
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
ini_set("memory_limit","2000M");
ini_set("max_execution_time","-1");
ini_set("max_input_time","-1");
ignore_user_abort(true);
set_time_limit(0);
0
Infocurci 2 months 0 Answers 9 views 0

Leave an answer