From 6382428bd0d1eeee6055445f5a7fcc92cb3afc83 Mon Sep 17 00:00:00 2001 From: Deniss Detkovs <3966291+ddetkovs@users.noreply.github.com> Date: Mon, 16 Aug 2021 12:38:16 +0200 Subject: [PATCH] Unsubscribe leaks subscriptions This only happens when publish is in progress. Unsubscribe goes through passed in subscriptions and adds the first subscription to the unsubscribe queue, but not the rest. Changing the return statement to continue fixes this, since it won't exit the for loop until it goes through all of the subscriptions and adds them to unsubscribe queue. --- src/Api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api.js b/src/Api.js index 4ab2ca3b..32f473e4 100644 --- a/src/Api.js +++ b/src/Api.js @@ -226,7 +226,7 @@ _.extend( postal, { subDef.inactive = true; if ( pubInProgress ) { unSubQueue.push( subDef ); - return; + continue; } channelSubs = this.subscriptions[ subDef.channel ]; topicSubs = channelSubs && channelSubs[ subDef.topic ];