From 4e0444bba883680716b87ba9c80d18cbd20bdffe Mon Sep 17 00:00:00 2001 From: Johannes Batzill Date: Mon, 6 Nov 2023 18:16:24 +0000 Subject: [PATCH] [SSE] close pubsub subscriber on sse completion (#769) --- app/sse/sse.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/sse/sse.go b/app/sse/sse.go index d35fb3768..78e3b1a17 100644 --- a/app/sse/sse.go +++ b/app/sse/sse.go @@ -96,11 +96,11 @@ func (e *pubsubStreamer) Stream( namespaceOption := pubsub.WithChannelNamespace(e.namespace) topic := getSpaceTopic(spaceID) consumer := e.pubsub.Subscribe(ctx, topic, g, namespaceOption) - unsubscribeFN := func(ctx context.Context) error { - return consumer.Unsubscribe(ctx, topic) + cleanupFN := func(ctx context.Context) error { + return consumer.Close() } - return chEvent, chErr, unsubscribeFN + return chEvent, chErr, cleanupFN } // getSpaceTopic creates the namespace name which will be `spaces:`.