[ad_1]
[ad_2]
Hi guys. Do you know a good way to run a function in the background to avoid affecting frontend performance? I created a script to create 1000 products in WooCommer, but it is too slow. I also created a cron function, but I want to run the function anytime I need it. I appreciate any help.

modify the script to add products in batches. put the script to sleep for 1/5/10 seconds after every 10/20/50 items (find the optimal values through trial and error). the script will take much longer to complete but shouldn’t overwhelm server resources.