compact method

  1. @override
Stream<String> compact(
  1. bool dryRun
)
override

Compact the notification queue. If dryRun is true, yields each notification key that WOULD be removed without performing the deletion. If false, performs the compaction and yields each key as it is removed.

Implementation

@override
Stream<String> compact(bool dryRun) async* {
  final expired = await (await getExpiredKeys()).toList();
  if (dryRun) {
    yield* Stream.fromIterable(expired);
    return;
  }
  for (final id in expired) {
    await remove(id, skipCommit: true);
    yield id;
  }
}