Skip to content

fix(cluster-engine): publish a Buffer to Redis from the primary - #5637

Open
NotAFlightRisk wants to merge 1 commit into
socketio:mainfrom
NotAFlightRisk:fix-cluster-engine-redis-publish
Open

NotAFlightRisk wants to merge 1 commit into
socketio:mainfrom
NotAFlightRisk:fix-cluster-engine-redis-publish

Conversation

@NotAFlightRisk

Copy link
Copy Markdown

The kind of change this PR does introduce

  • a bug fix (only a one-liner, mind)
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behavior

Set up as in the README's "Node.js cluster & Redis" example, the primary crashes the first time it passes a message on, and the client just gets a connect_error. setupPrimaryWithRedis() hands msgpack's Uint8Array straight to publish(), and node-redis only takes a string or a Buffer:

TypeError: "arguments[2]" must be of type "string | Buffer", got object instead

That's redis 6.3.1 with @socket.io/cluster-engine 0.1.1 (redis 4.7.1 says Invalid argument type instead).

New behavior

It goes through Buffer.from() first, like RedisEngine already does further down the same file, and the example works.

Other information (e.g. related issues)

I haven't added a test, since nothing covers setupPrimaryWithRedis() yet and a proper one needs a cluster and Redis running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant