Skip to content

Commit f97ba73

Browse files
bigger lock area to try to affect deadlock
1 parent 122aba2 commit f97ba73

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

graphql/subscription.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ func (s *subscriptionMap) Unsubscribe(subscriptionID string) error {
4848
}
4949

5050
func (s *subscriptionMap) GetAllIDs() (subscriptionIDs []string) {
51-
s.RLock()
52-
defer s.RUnlock()
5351
for subID := range s.map_ {
5452
subscriptionIDs = append(subscriptionIDs, subID)
5553
}

graphql/websocket.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ func (w *webSocketClient) Start(ctx context.Context) (errChan chan error, err er
196196
}
197197

198198
func (w *webSocketClient) Close() error {
199+
w.Lock()
200+
defer w.Unlock()
201+
w.isClosing.Store(true)
199202
if w.conn == nil {
200203
return nil
201204
}
@@ -207,9 +210,6 @@ func (w *webSocketClient) Close() error {
207210
if err != nil {
208211
return fmt.Errorf("failed to send closure message: %w", err)
209212
}
210-
w.Lock()
211-
defer w.Unlock()
212-
w.isClosing.Store(true)
213213
close(w.errChan)
214214
return w.conn.Close()
215215
}

0 commit comments

Comments
 (0)