func()

in pkg/operations/operations.go [68:89]


func (h HandlerImpl) Wait(ctx context.Context, op Operation) error {
	ctx, cancel := context.WithDeadline(ctx, time.Now().Add(h.deadline))
	defer cancel()
	ticker := time.NewTicker(h.interval)
	defer ticker.Stop()

	for {
		select {
		case <-ctx.Done():
			return fmt.Errorf("context error: %w", ctx.Err())
		case <-ticker.C:
			log.Debugf("Polling for %s", op)
			done, err := op.IsFinished(ctx)
			if err != nil {
				return err
			}
			if done {
				return nil
			}
		}
	}
}