updateRunLocked is called whenever the run goroutine needs to be started / stopped / restarted due to: 1. the initial listener being registered, 2. the final listener being unregistered, or 3. the minimum registered interval changing.
()
| 156 | // final listener being unregistered, or 3. the minimum registered interval |
| 157 | // changing. |
| 158 | func (p *producer) updateRunLocked() { |
| 159 | if p.stop != nil { |
| 160 | p.stop() |
| 161 | p.stop = nil |
| 162 | } |
| 163 | if len(p.listeners) > 0 { |
| 164 | var ctx context.Context |
| 165 | ctx, p.stop = context.WithCancel(context.Background()) |
| 166 | p.stopped = make(chan struct{}) |
| 167 | go p.run(ctx, p.stopped, p.minInterval) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | // run manages the ORCA OOB stream on the subchannel. |
| 172 | func (p *producer) run(ctx context.Context, done chan struct{}, interval time.Duration) { |
no test coverage detected