mirror of
https://github.com/harness/drone.git
synced 2025-05-19 02:20:03 +08:00
[SSE] close pubsub subscriber on sse completion (#769)
This commit is contained in:
parent
e731c0fdff
commit
4e0444bba8
@ -96,11 +96,11 @@ func (e *pubsubStreamer) Stream(
|
|||||||
namespaceOption := pubsub.WithChannelNamespace(e.namespace)
|
namespaceOption := pubsub.WithChannelNamespace(e.namespace)
|
||||||
topic := getSpaceTopic(spaceID)
|
topic := getSpaceTopic(spaceID)
|
||||||
consumer := e.pubsub.Subscribe(ctx, topic, g, namespaceOption)
|
consumer := e.pubsub.Subscribe(ctx, topic, g, namespaceOption)
|
||||||
unsubscribeFN := func(ctx context.Context) error {
|
cleanupFN := func(ctx context.Context) error {
|
||||||
return consumer.Unsubscribe(ctx, topic)
|
return consumer.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
return chEvent, chErr, unsubscribeFN
|
return chEvent, chErr, cleanupFN
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSpaceTopic creates the namespace name which will be `spaces:<id>`.
|
// getSpaceTopic creates the namespace name which will be `spaces:<id>`.
|
||||||
|
Loading…
Reference in New Issue
Block a user