action-scheduler
action-scheduler copied to clipboard
`has_pending_actions_due()` performance improvements
trafficstars
has_pending_actions_due() should
- pass
'claimed'astrueto the query to avoid triggering runners when there are no unclaimed tasks - pass
'per_page'with value 1 since it's sufficient to get 1 result (instead of the default 5) - pass
'orderby'with value'none'to avoid unnecessary overhead of sorting the actions table - pass 2nd parameter
'count'as that's faster than SELECT and sufficient for this use case
Sounds good!
Once we're ready to pick this up, let's just verify this is the correct way round:
pass 'claimed' as true to the query to avoid triggering runners when there are no unclaimed tasks
...We'd be receptive to a PR should you (or anyone) wish to submit one for this. Otherwise, we'll try and get to it in due course.