Do not return expired items in main scheduler loop.

This commit is contained in:
Antony 2025-03-27 20:00:21 +13:00
parent 3e7f09db62
commit 1b8f1b5c45

View File

@ -670,8 +670,10 @@ pub async fn get_schedulable_queue_items(limit: usize) -> Result<Vec<MulticastGr
on g.gateway_id = qi.gateway_id
where
qi.scheduler_run_after <= $2
-- check that the gateway is online, except when the item already has expired
and ($2 - make_interval(secs => g.stats_interval_secs * 2) <= g.last_seen_at or expires_at <= $2)
-- check that the gateway is online
and (
$2 - make_interval(secs => g.stats_interval_secs * 2) <= g.last_seen_at
)
order by
qi.created_at
limit $1