Skip to content

Commit

Permalink
fix #1798 - temp fix for __redis__:invalidate null messages
Browse files Browse the repository at this point in the history
  • Loading branch information
leibale committed Dec 29, 2021
1 parent b97d18b commit fd72a28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/client/lib/client/commands-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit fd72a28

Please sign in to comment.