Skip to content

v3.5.2

Choose a tag to compare

@github-actions github-actions released this 14 Sep 19:36
· 12 commits to master since this release

What's Changed

  • fix(cluster): replay every subscription handler to a joining server by @Gabriellji in #30 — closes #29

The bug. ClusteredRedisQueue remembered only one { channel, handler } pair, so each subscribe() overwrote the previous one. Handlers still reached the servers already in the cluster — which is why this stayed invisible while membership was stable — but a server joining later was replayed only the last-registered handler. With one handler carrying business events and another carrying cache invalidation, that host served the second and silently dropped the first: the socket stayed subscribed, the publisher still saw a subscriber, RPC was unaffected and health checks passed.

The fix. Every registration is now remembered and installed on a joining server, in registration order — including the same function registered twice, since subscribe() is additive as IMessageQueue documents. The live subscribe() path and the catch-up for a joining server are one serialised operation per host, so a handler cannot be installed twice.

Three smaller fixes from the same code:

  • a server that failed to start while joining produced an unhandled rejection — a process exit on current Node defaults; it is now consumed where it is already reported
  • a host added before start() could be left unstarted when the cluster was started a microtask later
  • destroy() now closes admission synchronously, settles a send() parked waiting for its first server, and attempts every cleanup task independently so one failure cannot strand the rest

Unit and integration coverage for cluster subscriptions was added alongside (test/integration/clusterSubscription.spec.ts, test/unit/ClusteredRedisQueue.spec.ts).

Full Changelog: v3.5.1...v3.5.2

About

@imqueue/core is the transport layer of the @imqueue framework: a fast JSON message queue over Redis for inter-service communication in Node.js & TypeScript microservices. No-poll delivery (blocking queue ops, zero idle CPU), optional safe delivery, delayed messages, and horizontal scale via competing consumers. Delivery is at-least-once — handlers should be idempotent.