Namespace Virtufin.WorkManager.Services
Classes
- AppMetrics
The WorkManager's OpenTelemetry meter and activity source name.
- RuntimeWorkerLoadCoordinator
Asynchronous worker creation (worker-management spec, "Create returns before the code is loaded").
CreateWorkerregisters a Runtime-backed worker as Loading and returns; this coordinator then drives the load in the background (LoadAsync(CancellationToken)), commits the outcome to the worker's catalog record, starts it if aStartWorkerarrived meanwhile, and publishes theloaded/load-failedlifecycle event (thenstartingandonlineorfailedfor a deferred start). A deferred start that fails leaves the loaded workerStopped, so it can be started again.Deferred start without a lost update. The outcome commit and TryRequestStartAsync(Guid, bool, CancellationToken) both go through etag compare-and-swap on the same catalog record, from any WorkManager replica. The commit reads StartRequested under the etag it writes with, and a start request only lands on a record still
Loading. So whichever writes second sees the other's write, and a start is never dropped. Starting is idempotent, so a retried commit that starts twice is harmless.At startup it also re-drives any Runtime-backed worker left
Loading(a WorkManager replica that died mid-load). Every replica does this; LoadAsync(CancellationToken) is idempotent and only one commit can win the compare-and-swap, so the others just observe the outcome.
- RuntimeWorkerPokeService
Periodically pokes the Runtime actor of every worker whose persisted status is running, so a worker that has gone quiet never ends up permanently deaf.
A Runtime worker's topic subscriptions are (re)created only by
StartAsyncor the actor'sOnActivateAsyncself-heal, and a Dapr actor activates only when something invokes it. A running worker with no inbound traffic gets no invocation: after a Runtime pod restart (its subscriptions are gone) or past the Runtime's 24hActorIdleTimeoutit would stay unsubscribed forever.A live actor gets a cheap Touch (resetting its idle timer and making sure the worker is started, so a worker whose lease lapsed claims again); a deactivated one reactivates, and its self-heal reloads the code, claims the lease, starts the worker and resubscribes. The gap is bounded by IntervalSecondsEnvVar (default 60 s, floored at 30 s).
- WorkerLoadFailedException
A worker whose background load failed (async CreateWorker).
Interfaces
- IOwnedTriggerCleaner
Deletes the triggers a worker owns (
owner_worker_id, api 0.8.6+) when the worker is deleted, so a trigger never outlives the worker it drives.