Start launches the background dispatcher. Calling Start multiple times is safe.
(ctx context.Context)
| 187 | |
| 188 | // Start launches the background dispatcher. Calling Start multiple times is safe. |
| 189 | func (m *Manager) Start(ctx context.Context) { |
| 190 | if m == nil { |
| 191 | return |
| 192 | } |
| 193 | m.once.Do(func() { |
| 194 | if ctx == nil { |
| 195 | ctx = context.Background() |
| 196 | } |
| 197 | var workerCtx context.Context |
| 198 | workerCtx, m.cancel = context.WithCancel(ctx) |
| 199 | go m.run(workerCtx) |
| 200 | }) |
| 201 | } |
| 202 | |
| 203 | // Stop stops the dispatcher and drains the queue. |
| 204 | func (m *Manager) Stop() { |
no test coverage detected