1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

fix #1798 - temp fix for __redis__:invalidate null messages

This commit is contained in:
leibale
2021-12-28 20:21:51 -05:00
parent b97d18b610
commit fd72a287b7

View File

@@ -71,7 +71,7 @@ export default class RedisCommandsQueue {
}
static #emitPubSubMessage(listenersMap: PubSubListenersMap, message: Buffer, channel: Buffer, pattern?: Buffer): void {
const keyString = (pattern || channel).toString(),
const keyString = (pattern ?? channel).toString(),
listeners = listenersMap.get(keyString);
if (!listeners) return;
@@ -82,7 +82,9 @@ export default class RedisCommandsQueue {
if (!listeners.strings.size) return;
const messageString = message.toString(),
// https://github.com/redis/redis/pull/7469
// https://github.com/redis/redis/issues/7463
const messageString = (Array.isArray(message) ? message.map(m => m.toString()) as any : message.toString()),
channelString = pattern ? channel.toString() : keyString;
for (const listener of listeners.strings) {
listener(messageString, channelString);