Skip to content

Commit 5f80d26

Browse files
author
Jannis Pohlmann
committed
subscriptions: Clean up after removing individual subscriptions
1 parent d48eb82 commit 5f80d26

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

subscriptions.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ func (m *subscriptionManager) RemoveSubscription(
171171

172172
// Remove the subscription from its connections' subscription map
173173
delete(m.subscriptions[conn], subscription.ID)
174+
175+
// Remove the connection as well if there are no subscriptions left
176+
if len(m.subscriptions[conn]) == 0 {
177+
delete(m.subscriptions, conn)
178+
}
174179
}
175180

176181
func (m *subscriptionManager) RemoveSubscriptions(conn Connection) {

0 commit comments

Comments
 (0)