WC_Payments_Action_Scheduler_Service::schedule_job() is causing slow downs #6662
Labels
category: performance
The issue/PR is related to performance.
type: good for architectural review
This issue/PR is related to / good for architectural review.
The
WC_Payments_Action_Scheduler_Service::schedule_job()
can get called dozens of times during the process of creating an order. Each time the callback is hit, callingas_unschedule_action()
is adding quite a bit of overhead. This handling was added in #1295.woocommerce-payments/includes/class-wc-payments-action-scheduler-service.php
Lines 147 to 153 in db6e444
Do we need to unschedule and reschedule the job, or can we simply call
as_has_scheduled_action()
instead?as_has_scheduled_action()
doesn't require that the query for the scheduled action be ordered by the date, so it doesn't have the same query issues with requiring a filesort that the normal query to get the next action does.cc @dmallory42
The text was updated successfully, but these errors were encountered: