Skip to content

Commit 42e979b

Browse files
author
Ruben Bridgewater
committed
Add changelog entry and add a note in the readme that detect_buffers does not work in pub sub mode
1 parent e8745af commit 42e979b

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ port and host are probably fine and you don't need to supply any arguments. `cre
182182
* `path`: *null*; The unix socket string to connect to
183183
* `parser`: *hiredis*; Which Redis protocol reply parser to use. If `hiredis` is not installed it will fallback to `javascript`.
184184
* `return_buffers`: *false*; If set to `true`, then all replies will be sent to callbacks as Buffers instead of Strings.
185-
* `detect_buffers`: *false*; If set to `true`, then replies will be sent to callbacks as Buffers
185+
* `detect_buffers`: *false*; If set to `true`, then replies will be sent to callbacks as Buffers. Please be aware that this can't work properly with the pubsub mode. A subscriber has to either always return strings or buffers.
186186
if any of the input arguments to the original command were Buffers.
187187
This option lets you switch between Buffers and Strings on a per-command basis, whereas `return_buffers` applies to
188188
every command on a client.

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Bugfixes
2323
- Fixed .multi / .batch used with Node.js 0.10.x not working properly after a reconnect ([@BridgeAR](https://github.com/BridgeAR))
2424
- Fixed fired but not yet returned commands not being rejected after a connection loss ([@BridgeAR](https://github.com/BridgeAR))
2525
- Fixed connect_timeout not respected if no connection has ever been established ([@gagle](https://github.com/gagle) & [@benjie](https://github.com/benjie))
26+
- Fixed return_buffers in pub sub mode ([@komachi](https://github.com/komachi))
2627

2728
## v.2.2.5 - 18 Oct, 2015
2829

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ RedisClient.prototype.return_reply = function (reply) {
653653
if (type === 'message') {
654654
this.emit('message', reply[1], reply[2]); // channel, message
655655
} else if (type === 'pmessage') {
656-
this.emit('pmessage', reply[1], reply[2], reply[3]); // pattern, channel, message
656+
this.emit('pmessage', reply[1].toString(), reply[2], reply[3]); // pattern, channel, message
657657
} else if (type === 'subscribe' || type === 'unsubscribe' || type === 'psubscribe' || type === 'punsubscribe') {
658658
if (reply[2] === 0) {
659659
this.pub_sub_mode = false;

0 commit comments

Comments
 (0)