expiredSessions static method

List<SessionGrant> expiredSessions(
  1. List<SessionGrant> grants,
  2. Object nowMs
)

Grants that are already dead at nowMs — the complement of activeSessions, and the list to revoke when reclaiming slots. Use this rather than filtering by hand: nowMs > expiresAtMs looks equivalent but leaves the grant expiring exactly at nowMs occupying a slot forever.

Implementation

static List<SessionGrant> expiredSessions(
    List<SessionGrant> grants, Object nowMs) {
  final now = _toBigInt(nowMs);
  return grants.where((g) => now >= g.expiresAtMs).toList();
}