MCPcopy
hub / github.com/kopia/kopia / sleepWithContext

Method sleepWithContext

cli/command_repository_upgrade.go:390–406  ·  view source on GitHub ↗
(ctx context.Context, dur time.Duration)

Source from the content-addressed store, hash-verified

388}
389
390func (c *commandRepositoryUpgrade) sleepWithContext(ctx context.Context, dur time.Duration) bool {
391 t := time.NewTimer(dur)
392 defer t.Stop()
393
394 stop := make(chan struct{})
395
396 c.svc.onTerminate(func() { close(stop) })
397
398 select {
399 case <-ctx.Done():
400 return false
401 case <-stop:
402 return false
403 case <-t.C:
404 return true
405 }
406}
407
408func (c *commandRepositoryUpgrade) drainAllClients(ctx context.Context, rep repo.DirectRepositoryWriter) error {
409 for {

Callers 1

drainAllClientsMethod · 0.95

Calls 3

StopMethod · 0.95
onTerminateMethod · 0.65
DoneMethod · 0.65

Tested by

no test coverage detected