// ReassignmentWait is the time duration the builder will wait after making an
// assignment before considering reassigning that same data.
510323
func (b *Builder) ReassignmentWait() time.Duration {
	return time.Duration(b.ring.ReassignmentWait) * time.Minute
}
877619
func (p *planner) asyncPlanWait(waitCh chan struct{}, future raft.ApplyFuture,
	result *structs.PlanResult, pending *pendingPlan) {
	defer metrics.MeasureSince([]string{"nomad", "plan", "apply"}, time.Now())
	defer close(waitCh)

	// Wait for the plan to apply
	if err := future.Error(); err != nil {
		p.logger.Error("failed to apply plan", "error", err)
		pending.respond(nil, err)
		return
	}

	// Respond to the plan
	result.AllocIndex = future.Index()

	// If this is a partial plan application, we need to ensure the scheduler
	// at least has visibility into any placements it made to avoid double placement.
	// The RefreshIndex computed by evaluatePlan may be stale due to evaluation
	// against an optimistic copy of the state.
	if result.RefreshIndex != 0 {
		result.RefreshIndex = maxUint64(result.RefreshIndex, result.AllocIndex)
	}
	pending.respond(result, nil)
}
388936
func UpgradeWait(wait bool) UpdateOption {
	return func(opts *options) {
		opts.updateReq.Wait = wait
	}
}
968916
func (s *InstancesCount) SetAssigning(v int64) *InstancesCount {
	s.Assigning = &v
	return s
}
944521
func (a *SetVirtualTimePolicyArgs) SetWaitForNavigation(waitForNavigation bool) *SetVirtualTimePolicyArgs {
	a.WaitForNavigation = &waitForNavigation
	return a
}
383647
func WriteWait(writeWait time.Duration) func(*WSClient) {
	return func(c *WSClient) {
		c.writeWait = writeWait
	}
}
605191
func (p *localPrevAlloc) Wait(ctx context.Context) error {
	p.waitingLock.Lock()
	p.waiting = true
	p.waitingLock.Unlock()
	defer func() {
		p.waitingLock.Lock()
		p.waiting = false
		p.waitingLock.Unlock()
	}()

	defer p.prevListener.Close()

	// Don't bother blocking for updates from the previous alloc if it has
	// already terminated.
	if p.prevStatus.Terminated() {
		p.logger.Trace("previous allocation already terminated")
		return nil
	}

	// Block until previous alloc exits
	p.logger.Debug("waiting for previous alloc to terminate")
	for {
		select {
		case prevAlloc, ok := <-p.prevListener.Ch():
			if !ok || prevAlloc.Terminated() {
				return nil
			}
		case <-ctx.Done():
			return ctx.Err()
		}
	}
}
1194615
func (ec *Envcfg) CertWait() time.Duration {
	if d := ec.GetDuration(ec.certWaitKey); d != 0 {
		return d
	}
	return DefaultCertWait
}
539422
func ConnectWait(t time.Duration) Option {
	return func(o *Options) error {
		o.ConnectTimeout = t
		return nil
	}
}
512183
func StartupWait(t time.Duration) HeapOption {
	return func(c *heapConfig) {
		c.startupWait = t
	}
}
417771
func (c *CronSchedule) Wait(last time.Time) Response {
	var err error
	now := time.Now()

	// first run
	if (last == time.Time{}) {
		last = now
	}
	// schedule not enabled, either due to first run or invalid cron entry
	if !c.enabled {
		err = c.schedule.AddFunc(c.entry, func() {})
		if err != nil {
			c.state = Error
		} else {
			c.enabled = true
		}
	}

	var misses uint
	if c.enabled {
		s := c.schedule.Entries()[0].Schedule

		// calculate misses
		for next := last; next.Before(now); {
			next = s.Next(next)
			if next.After(now) {
				break
			}
			misses++
		}

		// wait
		waitTime := s.Next(now)
		time.Sleep(waitTime.Sub(now))
	}

	return &CronScheduleResponse{
		state:    c.GetState(),
		err:      err,
		missed:   misses,
		lastTime: time.Now(),
	}
}
437715
func Wait4Scheduled(count int, timeout time.Duration) bool {
	return provider.Wait4Scheduled(count, timeout)
}
367314
func TaskWaitC(ctx types.Context, taskID int) <-chan int {
	return getTaskService(ctx).TaskWaitC(taskID)
}
850507
func (wg *SafeWaitGroup) Wait() {
	wg.mu.Lock()
	wg.wait = true
	wg.mu.Unlock()
	wg.wg.Wait()
}
270335
func (s *CPUUtilization) SetIOWait(v float64) *CPUUtilization {
	s.IOWait = &v
	return s
}
326524
func ReadWait(readWait time.Duration) func(*WSClient) {
	return func(c *WSClient) {
		c.readWait = readWait
	}
}
1354635
func NewWaitDelayState(stateName string, delay time.Duration) *WaitDelay {
	return &WaitDelay{
		baseInnerState: baseInnerState{
			name: stateName,
			id:   rand.Int63(),
		},
		delay: delay,
	}
}