dactor 1.3.0
dactor: ^1.3.0 copied to clipboard
An actor system for Dart
1.3.0 #
ask()no longer retries by default.AskConfig()now hasenableRetries: false. A retry re-sends the request, so with the old default a slow (not failed) actor executed the same command up to four times, and an ask to a dead actor blocked the caller for about 20 s.AskConfig.development()andAskConfig.production()still enable retries explicitly. Retries keep the samecorrelationIdacross attempts so receivers can deduplicate.- Fixed the Quick Start in the README and
example/dactor_example.dart. Both testedmessage is LocalMessageinsideonMessage, which is never true because actors receive the payload; the counter never incremented and the ask timed out. They now switch on the payload and reply viacontext.sender. - Removed the unused
cbordependency and the "zero dependencies" claim. - Added a
.pubignoresodoc/and repository tooling are not published. - A system built without a config no longer collects metrics or traces.
The previous defaults,
InMemoryMetricsCollectorandInMemoryTraceCollector, kept a timing sample for every message and a trace event (holding the payload) for every send and receive, forever; measured at roughly 485 MB retained per million messages. The defaults are nowNoOpMetricsCollectorandNoOpTraceCollector. Pass an explicit collector to opt in. Also addedNoOpLogCollector. InMemoryMetricsCollectorandInMemoryTraceCollectorare now bounded (maxTimingsper metric andmaxEventsoverall, both 10,000 by default). The tracer evicts whole correlation ids, oldest first, and exposeseventCountandclear();tracesis now a read-only view.dactor.dartnow exports the metrics, tracing, logging and routing libraries (Pool,RoutingLogic, the collectors,LogRecord, ...), which already appeared in public signatures but could only be imported fromsrc/.- Supervision is routed by an explicit parent record, not by parsing
/in the actor id. Previously the system took everything before the last/as the supervisor and cast it withas SupervisorActor; an actor namedplain/evilunder a non-supervisorplaintherefore killed the whole process with an unhandledTypeErroron its first failure, and any actor could attach itself to a foreign supervisor by choosing its name. Children are now created throughSupervisorActor.supervise(internallyLocalActorSystem.spawnChild), which records the parent, requires the parent to be a liveSupervisor, and rejects child ids that are empty or contain/. Actors spawned with a/in their id throughspawnare ordinary unsupervised actors.RouterActorsupervises its workers through the same path. Addedtest/supervision_guard_test.dart. - Restart now happens in place. Previously a restart stopped the actor and
spawned a new one, which created a new
ActorRef; every reference held by other actors (including pool workers) then went to dead letters, pending messages were discarded, watchers receivedTerminated, and event-bus subscriptions were lost. A restart now keeps the ref, mailbox, watchers and subscriptions and only replaces theActorinstance:postStopon the old one, timers cancelled,preStarton the new one.SupervisorActorandRouterActoruse this path. Messages are never dispatched to an actor whosepreStarthas not completed. Addedtest/restart_test.dart. - Errors thrown while handling a child failure (for example a replacement's
preStartthrowing) no longer escape as unhandled zone errors. The child is stopped,actors.supervision_failedis incremented and the error is logged. - Add
dactor_testas a dev dependency. The 1.2.0 release moved the test toolkit out of this package but never declared it, so 9 of the 12 test files could not load from a clean checkout. Added a GitHub Actions workflow that runsdart analyzeand the unit tests on every push and pull request. - README: the testing section now points at the
dactor_testpackage. - Fix
shutdown()not stopping any actor.stop()returned early once the shutdown flag was set, sopostStopnever ran, timers kept firing (keeping the isolate alive), refs stayedisAlive, and late messages were silently queued instead of dead-lettered. Actors are now torn down in reverse spawn order during shutdown. Addedtest/shutdown_test.dart.
1.2.0 #
- Fix actor model correctness, supervision, and messaging issues
- Remove
testfrom regular dependencies (was incorrectly listed as runtime dep) - Extract test utilities into separate
dactor_testpackage
1.1.0 #
- Docs: Added comprehensive documentation for testing actors, including
TestActorSystem,TestProbe, and message tracing.
1.0.0 #
- Initial version.