Drain unsubscribes from the stream and cancels subscription. All messages that are already in the buffer will be processed in callback function.
()
| 224 | // Drain unsubscribes from the stream and cancels subscription. |
| 225 | // All messages that are already in the buffer will be processed in callback function. |
| 226 | func (s *pushSubscription) Drain() { |
| 227 | if !s.closed.CompareAndSwap(false, true) { |
| 228 | return |
| 229 | } |
| 230 | s.Lock() |
| 231 | defer s.Unlock() |
| 232 | close(s.done) |
| 233 | s.subscription.Drain() |
| 234 | if s.hbMonitor != nil { |
| 235 | s.hbMonitor.Stop() |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | // Closed returns a channel that is closed when consuming is |
| 240 | // fully stopped/drained. When the channel is closed, no more messages |
nothing calls this directly
no test coverage detected