Skip to content

Commit d99382b

Browse files
committed
unsubscrube on context cancel for synchronous resolve
1 parent 198035a commit d99382b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

v2/pkg/engine/resolve/resolve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,6 @@ func (r *Resolver) executeStartupHooks(add *addSubscription, updater *subscripti
680680
return nil
681681
}
682682

683-
684683
func (r *Resolver) addSubscriptionIndex(s *subscriptionState) {
685684
id := s.id
686685
r.subscriptionsByID[id] = s
@@ -1318,6 +1317,7 @@ func (r *Resolver) ResolveGraphQLSubscription(ctx *Context, subscription *GraphQ
13181317
select {
13191318
case <-ctx.ctx.Done():
13201319
// Client disconnected, request context canceled.
1320+
_ = r.UnsubscribeSubscription(id)
13211321
select {
13221322
case <-completed:
13231323
// Wait for the subscription to be completed to avoid race conditions

0 commit comments

Comments
 (0)