queuekit 1.1.0
queuekit: ^1.1.0 copied to clipboard
A persistent task queue for Dart and Flutter. Runs events in order, retries failures, keeps dependent events in order and restores the queue across app restarts.
1.1.0 #
- Feat: Dependent events, pending event queries and documentation (#6)
Queue.addtakesdependsOn, the pending events that must complete first. If a dependency is retried, its dependents move to the retry queue with it and are re-queued behind it in their original order. If it fails permanently, they fail with aDependencyFailedExceptionwithout running.HydratedQueuepersists dependencies.- Query pending events with
Queue.pendingEvents,Queue.findEventandQueue.findEvents. RetryConfig.canRetry, andEventFailedException.willRetrytells whether the failed event is going to be retried.- Every feature is documented in the README and the public API in dartdoc.
- Fix: The built-in retry config serializers persist
retryCount, so a restored event continues its retry budget and backoff instead of starting over after every restart. - Fix:
HydratedQueue.hydrateno longer drops persisted retries whose config retries forever. - Fix:
HydratedQueuesaves the changes of one synchronous run together and writes saves one at a time, in order, so slow storage cannot persist an older state over a newer one and a re-queued retry never transiently disappears from storage. - Fix:
HydratedQueuerecordsawaitingRetryon persisted retry entries, so a restored event waiting for its own retry keeps its timer and one waiting for a dependency does not get a spurious one. - Fix: A failed save no longer stops all later saves; the failure surfaces from the
addfuture that caused it. - Fix:
HydratedQueue.hydratedrops dependencies on events that could not be restored, and a finished event is removed from the dependencies of the events that depended on it. - Fix:
Queue.waitForno longer fails on a failure that is going to be retried; it completes with the eventual result or the final failure. - Fix:
listenWhereonly passes errors for events of the listened type toonError, instead of throwing aTypeErrorfor other events. - Fix: Resuming a queue while an event is running no longer starts a second processing loop, and disposing it while an event is running no longer throws once the event completes.
- Fix:
exponentialBackoffRetryConfigSerializeraccepts an integermultiplier.
1.0.0 #
Note: This release has breaking changes.
Not published separately: the first release after 0.1.0 includes it.
- BREAKING CHORE: require Dart SDK
^3.11.0. - BREAKING REFACTOR:
Queue.waitForthrows synchronously when the queue is already disposed. - BREAKING REFACTOR:
Queueno longer extendsStream. Listen throughQueue.results,listenAll,listenWhereorwaitFor. - BREAKING REFACTOR:
HydratedQueuetakes a list of typedEventSerializer<T>objects instead of theEventSerializersmap, so the event type is written once on the event class andtoJsonneeds no cast. Adding an event without a matching serializer throws anArgumentErrorinstead of silently not persisting it. - BREAKING REFACTOR:
Queue.currentQueueandQueue.retryQueueare read-only views, andQueue.runningandQueue.uuidare removed. - BREAKING REFACTOR: the protected
Queue.removeIndexFromCurrentQueue(int)hook is replaced byremoveFromCurrentQueue(Event);addToRetryQueuetakes the absolutenextExecutionTime; subclasses getaddToCurrentQueue,releaseUnblockedEvents,isAwaitingRetry,isWaitingForDependencyand thedependenciesmap. - BREAKING REFACTOR:
LinearRetryConfig.serializerandExponentialBackoffRetryConfig.serializerare getters instead of mutable fields. - BREAKING REFACTOR:
EventFailedException.toStringnames the event id and type. - REFACTOR:
HydratedQueue.hydratereturnsFuture<void>instead ofFutureOr<void>. - REFACTOR: reformat code with the Dart 3.11 formatter.
- TEST: restructure tests with Given/When/Then.
- CHORE: upgrade dependencies, raising the lower bound of
metato^1.17.0, and drop the unuseduuiddependency.
0.1.0 #
Note: This release has breaking changes.
- FEAT: add check for if queue is already disposed.
- FEAT: update readme.
- FEAT: add license.
- FEAT: update changelog.
- FEAT: add waitFor.
- FEAT: update example.
- FEAT: fix queuekit.
- FEAT: convert repo to monorepo using melos (#5).
- BREAKING FEAT: remove HydratedEvent.
0.0.1 #
- Initial version.