Method
waitWorkers
(workersWG *sync.WaitGroup)
Source from the content-addressed store, hash-verified
| 241 | } |
| 242 | |
| 243 | func (m *Manager) waitWorkers(workersWG *sync.WaitGroup) bool { |
| 244 | if workersWG == nil { |
| 245 | return false |
| 246 | } |
| 247 | |
| 248 | drainCtx, cancelDrain := context.WithTimeout(context.Background(), m.shutdownDrainTimeout) |
| 249 | defer cancelDrain() |
| 250 | |
| 251 | done := make(chan struct{}) |
| 252 | go func() { |
| 253 | defer close(done) |
| 254 | workersWG.Wait() |
| 255 | }() |
| 256 | |
| 257 | select { |
| 258 | case <-done: |
| 259 | return false |
| 260 | case <-drainCtx.Done(): |
| 261 | return true |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func (m *Manager) finalizeUnresolvedOnShutdown(cancelInflight, timedOut bool) { |
| 266 | if !cancelInflight { |
Tested by
no test coverage detected