]> cat aescling's git repositories - mastodon.git/commitdiff
Fix timeline streaming stopping for multiple sessions instead of one (#17259)
authorClaire <claire.github-309c@sitedethib.com>
Fri, 7 Jan 2022 18:50:12 +0000 (19:50 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Jan 2022 18:50:12 +0000 (19:50 +0100)
* Fix timeline streaming stopping for multiple sessions instead of one

Fixes #17256.

In updating the code for a newer version of node-redis, #17183 also broke
redis subscription management when multiple streaming clients subscribe to the
same channel.

This commit restores the redis subscription management code.

* Let node-redis actually handle the subscriptions

streaming/index.js

index 74cbf4c2c4542900f2fbcefc0267ec6fd2ba078c..47f938b869c0788f9971bf4317f604cf88ce474b 100644 (file)
@@ -197,10 +197,12 @@ const startWorker = async (workerId) => {
 
   /**
    * @param {string} channel
+   * @param {function(string): void} callback
    */
-  const unsubscribe = (channel) => {
+  const unsubscribe = (channel, callback) => {
+    log.silly(`Removing listener for ${channel}`);
 
-    redisSubscribeClient.unsubscribe(channel);
+    redisSubscribeClient.unsubscribe(channel, callback);
   };
 
   const FALSE_VALUES = [