github redis/ioredis v6.1.0

one hour ago

v6.1.0

✨ Highlights

This release adds smart client handoffs: the client listens for Redis maintenance notifications, relaxes command and socket timeouts while maintenance is in progress and moves connections to the new endpoint, so planned upgrades and failovers on Redis Enterprise and Redis Cloud cause fewer errors. Cluster sharded Pub/Sub gets a health check that detects subscribers which stop receiving messages and reconnects them. The command set grows with the Redis 8.12 set member expiration, sorted set move,BITRANGEINTARRAY and BLESS commands. Many fixes land for reconnection, the selected database, Cluster pipelines and autopipelining, Sentinel and RESP3 decoding.

🚀 New Features

  • client: smart client handoffs, which handle Redis maintenance notifications with the maintNotifications, maintEndpointType, maintRelaxedCommandTimeout and maintRelaxedSocketTimeout options (#2165)
  • cluster: add a health check for sharded subscribers, configured with shardedSubscriberHealthCheckInterval (default 10000 ms, null disables it) (#2268)
  • cluster: add the subscriberNodeRole option to choose the node role for the Pub/Sub subscriber (#2176)
  • commands: add the set member expiration commands SADDEX, SEXPIRE, SEXPIREAT, SEXPIRETIME, SPERSIST, SPEXPIRE, SPEXPIREAT, SPEXPIRETIME, SPTTL and STTL (Redis 8.12) (#2261)
  • commands: add the sorted set move commands ZMOVE, BZMOVE and ZMOVEMEMBER (Redis 8.12), with BZMOVE handled as a blocking command (#2288)
  • commands: add BITRANGEINTARRAY (Redis 8.12) (#2279)
  • commands: add the BLESS command family (Redis 8.12) (#2209)

🐛 Bug Fixes

Connection and reconnection

  • End the client when quit() or disconnect() is called while reconnecting (#2245)
  • Reset retry attempts when connect() is called after the client gave up (#2204)
  • Reset the manual close state when connect() is called after end (#2250)
  • Reject unfulfilled commands dropped on reconnect (#2194)
  • Handle rejections from auto-resubscribe and SELECT on reconnect (#2187)
  • Close the monitor connection when monitor() rejects (#2247)

Selected database

  • Keep the selected database for commands queued while reconnecting (#2235)
  • Restore the database selected by a non-lowercase SELECT after reconnecting (#2248)
  • Handle a rejection from the database-restoring SELECT on reconnectOnError (#2229)

Cluster lifecycle

  • Fix the cluster getting stuck in close (#2217)
  • End when quit() or disconnect() is called while reconnecting (#2240)
  • Stay ended when nodes removed by disconnect() end late (#2237)
  • Stop refreshing slots when disconnect() is called during a refresh (#2249)
  • Do not fall back to a replica when no primary is left (#2275)
  • Map every slot when stringNumbers is enabled (#2255)
  • Pass the retry delay to the reconnecting event (#2291)

Cluster pipelines and autopipelining

  • Resend only the redirected command in a pipeline (#2214)
  • Do not reject pipeline commands for connecting nodes when the offline queue is disabled (#2277)
  • Do not throw when autopipelining meets an uncached slot (#2233)
  • Bucket autopipelined MSET objects by their first key (#2207)
  • Hash autopipelined Buffer keys by their bytes (#2208)
  • Hash lone surrogates as the UTF-8 that Node sends (#2242)
  • Vendor cluster-key-slot to fix the slot of keys with an empty hash tag (#2172)
  • Align autopipeline callbacks for dynamic commands (#2180)

Cluster Pub/Sub

  • Keep forwarding sharded messages after reconnecting from end (#2251)
  • Support a zero-argument SUNSUBSCRIBE with sharded subscribers (#2137)
  • Match Buffer shard channels when unsubscribing (#2203)
  • Emit sharded subscriber connect errors silently (#2241)
  • Inherit connectTimeout for cluster subscribers (#2220)

Sentinel

  • Retry unreachable sentinels in a loop instead of recursing (#2270)
  • Correct the retry order after node connection failures (#2246)
  • Handle errors on failover detector connections (#2257)
  • Clean up failover subscriptions after quit() (#2198)

Pub/Sub

  • Keep subscriber mode while other channel kinds remain subscribed (#2196)
  • Resolve an argument-less UNSUBSCRIBE / PUNSUBSCRIBE once its own kind is empty (#2238)

RESP and replies

  • Decode RESP3 attribute replies instead of failing the connection (#2213)
  • Decode RESP3 doubles with Number (#2150)
  • Decode integer replies up to Number.MAX_SAFE_INTEGER exactly (#2164)
  • Keep String.prototype in fast mode after defining VerbatimString (#2206)
  • Apply the legacy reply shape to uppercase command names (#2252)

Commands and errors

  • Redact credentials from the command attached to errors (#2231)
  • Keep the exec() error out of its own previousErrors (#2218)
  • Preserve empty keys and MATCH patterns in scan streams (#2199)

Types

  • Accept field arrays in hmget / hmgetBuffer (#2167)
  • Accept string | string[] for del (#2230)
  • Allow a number for the zrange stop argument (#2163)
  • Accept the documented TLS profile options (#2195)
  • Add event overloads to the Cluster interface (#2201)
  • Add smessage and smessageBuffer event overloads (#2191)

🧰 Maintenance

  • ci: publish to npm with trusted publishing and staged approval, and run the release job in the Release environment (#2226, #2303)
  • ci: update the Redis 8.12 test image (#2273, #2287)
  • test: run the standard functional suite against an external Redis Enterprise database and skip incompatible suites (#2140, #2177)
  • test: add regression coverage for a deeply nested reply, subscribing during connect and +switch-master during Sentinel rediscovery (#2138, #2202, #2293)
  • test: tolerate early timer firing in timeout relaxation baselines (#2232)
  • docs: explain per-master cluster key scanning, fix multi-node cluster examples and correct the slotsRefreshInterval default (#2295, #2271, #2236)
  • docs: clarify Sentinel TLS options, list all built-in argument transformers and explain custom script inheritance in duplicate connections (#2292, #2290, #2225)
  • docs: update the contribution guidelines (#2188)
  • chore: remove the CLAUDE.md symlink in favour of AGENTS.md and remove the maintainer-review agent skill (#2200, #2244)
  • deps: bump undici, brace-expansion, serialize-javascript, mocha, handlebars, js-yaml, browserslist and @babel/core (#2173, #2175, #2179, #2184, #2185, #2210, #2216, #2224, #2263, #2265)
  • deps: bump express, body-parser, qs, morgan and proxy-addr in examples/express (#2174, #2183, #2211, #2223, #2234, #2264)

Full Changelog: v6.0.0...v6.1.0

Don't miss a new ioredis release

NewReleases is sending notifications on new releases.