Skip to content

ioredis 6 Support and Safer Reconnections

Latest

Choose a tag to compare

@github-actions github-actions released this 18 Oct 07:20
· 2 commits to 0.x since this release

Highlights

  • ioredis 6 support. The Redis transport now accepts ioredis ^5.0.0 || ^6.0.0.
  • mqtt security fixes. The minimum supported mqtt version is now 5.16.0, which fixes six advisories where a malicious or misbehaving broker can crash the client process. Upgrade mqtt if you are on an older version.
  • Subscriber errors no longer crash the process. A handler that throws or rejects is now caught and logged with the boringnode:bus debug logger, and the other handlers for the same message still run. Catch errors inside your handlers if you need to react to them.

Fixed

Redis

  • Flush the retry queue every time the publisher is ready. Previously it was flushed while Redis was still down, so queued messages could stay stuck, and it never flushed with Redis Cluster.
  • Handle errors on the transport connections. Connection errors no longer print "[ioredis] Unhandled error event" to stderr. When the transport is built from your own Redis or Cluster instance, the errors are also emitted on that instance.
  • disconnect() no longer throws while a connection is reconnecting with enableOfflineQueue: false, and no longer leaves that connection retrying forever and keeping the process alive.

MQTT

  • Deliver messages to wildcard subscriptions (+ and #). Previously, handlers subscribed to a/+ or a/# were never called.
  • Stop forcing a reconnection on every bus. Brokers no longer see repeated CONNECTs and session takeovers, operations no longer randomly fail with "Connection closed", and the retry queue is flushed after a real reconnection.

Bus and retry queue

  • BusManager.disconnect() now disconnects every cached bus instead of only the default one, so the process can exit, and a later use() creates a fresh bus.
  • Fix the retry queue dropping an unsent message when maxSize was reached while it was processing.
  • Calling dequeue() on an empty queue with removeDuplicates: true no longer throws.
  • The memory transport no longer keeps channels in memory after their last handler unsubscribes.

Package

  • Fix the @boringnode/bus/test_helpers export, which failed with ERR_MODULE_NOT_FOUND.
  • ChaosTransport.setId() now returns the chaos wrapper, so chaining from it keeps the chaos behavior.
  • mqtt is now an optional peer dependency, like ioredis. Importing the MQTT transport from an installed package no longer fails.
  • Projects using only the memory transport with skipLibCheck: false no longer fail to type-check when ioredis or mqtt is not installed. Import types from @boringnode/bus/types/core. types/main still re-exports everything.

Documentation

  • Fixed the README examples.
  • Documented delivery guarantees: the retry queue only retries publishing, Redis and MQTT pub/sub deliver at most once, overlapping MQTT filters call handlers once per broker copy, and Redis Cluster does not preserve message order.

Maintenance

  • Updated dependencies.