Hi @3yq9nfgnvh
Apologies for the runaround.
as_get_scheduled_actions() does work for in-progress actions. The query itself is straightforward, and there’s no technical limitation preventing it:
$running = as_get_scheduled_actions( array(
'status' => ActionScheduler_Store::STATUS_RUNNING,
'hook' => 'your_hook_name',
'per_page' => 100,
) );
The reason you’re probably not seeing results is that actions only stay in in-progress status for the few seconds they’re actually executing. Once done, they immediately flip to complete (or failed). There’s also a cleanup process (ActionScheduler_QueueCleaner::mark_failures()) that runs every queue cycle and auto-marks any in-progress action older than 5 minutes as failed. So the window to catch one mid-flight is very small.
If what you actually need is “all actions that haven’t finished yet” (both queued and currently executing), query both statuses at once:
$active = as_get_scheduled_actions( array(
'status' => array(
ActionScheduler_Store::STATUS_PENDING,
ActionScheduler_Store::STATUS_RUNNING,
),
'hook' => 'your_hook_name',
'per_page' => 100,
) );
Or if you just need to know whether a specific hook has something pending or running, as_has_scheduled_action() already checks both statuses internally:
if ( as_has_scheduled_action( 'your_hook_name' ) ) {
// Something is either pending or currently running.
}
One other thing, the default per_page is 5. If you have more than 5 actions and aren’t setting that parameter, you’ll get an incomplete set back.
Let me know what you’re trying to do with this, and I can point you to the most direct path.