action-scheduler icon indicating copy to clipboard operation
action-scheduler copied to clipboard

`has_pending_actions_due()` performance improvements

Open kkmuffme opened this issue 1 year ago • 2 comments
trafficstars

has_pending_actions_due() should

  1. pass 'claimed' as true to the query to avoid triggering runners when there are no unclaimed tasks
  2. pass 'per_page' with value 1 since it's sufficient to get 1 result (instead of the default 5)
  3. pass 'orderby' with value 'none' to avoid unnecessary overhead of sorting the actions table
  4. pass 2nd parameter 'count' as that's faster than SELECT and sufficient for this use case

kkmuffme avatar Feb 24 '24 23:02 kkmuffme

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

barryhughes avatar Feb 28 '24 22:02 barryhughes

...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.

barryhughes avatar Feb 28 '24 22:02 barryhughes