Why this is simpler
Every attempt transition is one atomic MongoDB update:pulse.history.find() API remains available. It projects the current attempt and the
latest ten completed outcomes stored on each delivery.
Concurrency
Deliveries are independent and may run concurrently.maxConcurrency controls the number of
callbacks for one topic in one process, while workerCount limits the entire Pulse instance.
Atomic claim filters and fencing tokens still ensure that only one replica owns a specific attempt.
Handlers remain at-least-once by default and should use event.id as an idempotency key.
Lower database load
The runtime hot path now touches only events, subscriptions, and deliveries. It no longer polls or writes a physical attempt collection and has no cross-collection reconciliation pass. Maintenance stays outside the hot loop:- Expired delivery locks are reaped in bounded indexed batches.
- The discovery leader periodically deletes successful deliveries only after its persisted cursor has passed the event.
- When retention is enabled, cleanup requires
delivery.expiresAt; MongoDB TTL remains the fallback.
Production upgrade
The update is compatible with the previous delivery-resident runtime and can be deployed gradually:- Update
@orion-js/pulseand@orion-js/echoesin one service. - Deploy its replicas normally and verify callbacks, retry age, and delivery backlog.
- Continue service by service until every runtime has the new packages.
- After the rollout, obsolete subscription fields may be removed from MongoDB with
$unset.
Persisted configuration
configVersion continues to protect durable settings during rolling deploys:
- Higher versions replace lower versions atomically.
- Lower-version replicas adopt the persisted winner.
- Different settings at the same version fail fast.
maxConcurrencyremains local and is not persisted.