durable_queue_workmanager library

Run a durable_queue from Workmanager background jobs, without the background job and the app's foreground queue ever running the same storage at once.

Classes

FileQueueLease
A QueueLease kept in a small file.
LeasedDrainResult
What drainWithLease did.
LeasedQueueLifecycle
Runs a LeasedQueueRunner while the app is in the foreground.
LeasedQueueRunner
Runs the app's DurableQueue only while it holds a QueueLease, so a background job that drains the same storage never runs beside it.
QueueBackgroundWork
Runs a durable_queue from Workmanager background jobs.
QueueLease
Permission for one runner at a time to work through a queue's storage.

Functions

drainWithLease({required QueueLease lease, required FutureOr<DurableQueue> openQueue(), Duration? timeLimit, bool waitForScheduled = false, Future<void> closeQueue(DurableQueue queue)?, QueueClock clock = const SystemQueueClock()}) → Future<LeasedDrainResult>
Takes lease, opens a queue with openQueue, drains it, closes it, and gives the lease back.