On VIP, we can make use of its scalable cron infrastructure to offload multiple generate events.
By adding a count parameter to the wc_smooth_generate_objecthere, we can basically schedule events that could run on a constant basis to generate the imports as:
which would allow creating 10 events each generating 10 orders running each minute. The cron infrastructure would scale itself based on the number of events needed to process.
The code I am using currently looks like this:
function wc_smooth_generate_object( $type, $count = 1) {
// Check what generation task to perform
$i = 0;
while($i++ < $count) {
switch ( $type ) {
case 'order':
Generator\Order::generate();
break;
case 'product':
Generator\Product::generate();
break;
case 'customer':
Generator\Customer::generate();
break;
case 'coupon':
Generator\Coupon::generate();
break;
default:
return false;
}
}
return false;
}
add_action( 'wc_smooth_generate_object', 'wc_smooth_generate_object' , 10, 2);
Happy to add a PR if this can be considered. It should have no impact on the existing functionality.
Describe the solution you'd like
On VIP, we can make use of its scalable cron infrastructure to offload multiple generate events.
By adding a count parameter to the
wc_smooth_generate_object
here, we can basically schedule events that could run on a constant basis to generate the imports as:which would allow creating 10 events each generating 10 orders running each minute. The cron infrastructure would scale itself based on the number of events needed to process.
The code I am using currently looks like this:
Happy to add a PR if this can be considered. It should have no impact on the existing functionality.
Describe alternatives you've considered
No response
Additional context
No response