Skip to content

Commit

Permalink
Fix timeline streaming stopping for multiple sessions instead of one (m…
Browse files Browse the repository at this point in the history
…astodon#17259)

* Fix timeline streaming stopping for multiple sessions instead of one

Fixes mastodon#17256.

In updating the code for a newer version of node-redis, mastodon#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
  • Loading branch information
ClearlyClaire authored Jan 7, 2022
1 parent e002f32 commit bc066d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions streaming/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit bc066d8

Please sign in to comment.