pendingSyncEntries method
Returns entries with synced = false in insertion order, up to limit.
If readyAt is non-null, also filters entries to those whose
next_retry_at is null OR <= readyAt. The engine passes its
current clock here to skip backoff-deferred entries. When omitted,
every pending entry is returned regardless of next_retry_at
(preserves Plan 1 behaviour).
Implementation
@override
Future<List<SyncQueueEntry>> pendingSyncEntries({
int? limit,
DateTime? readyAt,
}) async {
bool ready(SyncQueueEntry e) {
if (readyAt == null) return true;
final r = e.nextRetryAt;
return r == null || !r.isAfter(readyAt);
}
final pending = _queue.where((e) => !e.synced && ready(e)).toList();
if (limit == null || limit >= pending.length) return pending;
return pending.sublist(0, limit);
}