Skip to content

Commit

Permalink
fix: fix exceptions on messages of client side cache (#1479)
Browse files Browse the repository at this point in the history
when works with the new server assist client side cache feature, redis sends single string "__redis__:invalidate" from server.
so reply[2] is null, the update fixes the issue
  • Loading branch information
samswen committed Jan 11, 2022
1 parent 2939f8a commit 02adca4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/DataHandler.ts
Expand Up @@ -119,7 +119,7 @@ export default class DataHandler {
case "message":
if (this.redis.listeners("message").length > 0) {
// Check if there're listeners to avoid unnecessary `toString()`.
this.redis.emit("message", reply[1].toString(), reply[2].toString());
this.redis.emit("message", reply[1].toString(), reply[2] ? reply[2].toString() : '');
}
this.redis.emit("messageBuffer", reply[1], reply[2]);
break;
Expand Down

0 comments on commit 02adca4

Please sign in to comment.