MCPcopy
hub / github.com/dgraph-io/dgraph / terminateSubscriptions

Method terminateSubscriptions

graphql/subscription/poller.go:236–248  ·  view source on GitHub ↗

TerminateSubscriptions will terminate all the subscriptions of the given bucketID.

(bucketID uint64)

Source from the content-addressed store, hash-verified

234
235// TerminateSubscriptions will terminate all the subscriptions of the given bucketID.
236func (p *Poller) terminateSubscriptions(bucketID uint64) {
237 p.Lock()
238 defer p.Unlock()
239 subscriptions, ok := p.pollRegistry[bucketID]
240 if !ok {
241 return
242 }
243 for _, subscriber := range subscriptions {
244 // Closing the channel will close the graphQL websocket connection as well.
245 close(subscriber.updateCh)
246 }
247 delete(p.pollRegistry, bucketID)
248}
249
250func (p *Poller) TerminateSubscription(bucketID, subscriptionID uint64) {
251 p.Lock()

Callers 1

pollMethod · 0.95

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected