Skip to content

Commit 26f7f84

Browse files
committed
Protect against closing interfaceChan multiple times
1 parent 5b2e93b commit 26f7f84

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

graphql/websocket.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ func (w *webSocketClient) listenWebSocket() {
121121
// interfaceChan's are closed at the top of listenWebSocket to
122122
// guarantee the channels are closed even if listenWebSocket will exit.
123123
w.subscriptions.forEachSubscription(func(sub *subscription) {
124-
if sub.hasBeenUnsubscribed() {
124+
if sub.hasBeenUnsubscribed() && sub.interfaceChan != nil {
125125
reflect.ValueOf(sub.interfaceChan).Close()
126+
sub.interfaceChan = nil
126127
}
127128
})
128129
if w.isClosing {

0 commit comments

Comments
 (0)