// Augment the default Do to set a timeout.
777888
func (rt *registryRoundTripper) Do(ctx context.Context, r *http.Request,
	v interface{}) (*http.Response, error) {

	ctx, cancelFunc := context.WithTimeout(ctx, 60*time.Second)
	r = r.WithContext(ctx)
	defer cancelFunc()

	resp, err := rt.DefaultRequestDoer.Do(ctx, r, v)
	if err != nil {
		if ctx.Err() == context.DeadlineExceeded {
			err = &apitypes.Error{
				Type: apitypes.RequestTimeoutError,
				Err:  []string{"Request timed out"},
			}
		}

		return nil, err
	}

	return resp, nil
}
744507
func (s *HealthCheck) SetTimeout(v int64) *HealthCheck {
	s.Timeout = &v
	return s
}
510710
func timeoutWithDefault(configuredValue time.Duration, defaultValue time.Duration) time.Duration {
	if configuredValue == 0 {
		return defaultValue
	}
	return configuredValue
}
1285069
func (s *BulkService) Timeout(timeout string) *BulkService {
	s.timeout = timeout
	return s
}
1042362
func addDefaultTimeout(tt fab.TimeoutType) RequestOption {
	return func(ctx context.Client, o *requestOptions) error {
		if o.Timeouts[tt] == 0 {
			return WithTimeout(tt, ctx.EndpointConfig().Timeout(tt))(ctx, o)
		}
		return nil
	}
}
650106
func (r *Req) SetTimeout(d time.Duration) {
	r.Client().Timeout = d
}
1290650
func (d *Death) SetTimeout(t time.Duration) *Death {
	d.timeout = t
	return d
}
584518
func (c *Config) SetTimeout(t time.Duration) error {
	if c == nil {
		return fmt.Errorf("nil config")
	} else if c.httpClient == nil {
		return fmt.Errorf("nil HTTP client")
	} else if c.httpClient.Transport == nil {
		return fmt.Errorf("nil HTTP client transport")
	}

	// Apply a timeout.
	if t.Nanoseconds() >= 0 {
		transport, ok := c.httpClient.Transport.(*http.Transport)
		if !ok {
			return fmt.Errorf("unexpected HTTP transport: %T", c.httpClient.Transport)
		}

		transport.DialContext = (&net.Dialer{
			Timeout:   t,
			KeepAlive: 30 * time.Second,
		}).DialContext
	}

	return nil
}
1166889
func doAsyncTimeout(f func() error, tmFunc func(error), timeout time.Duration) error {
	errs := make(chan error)
	go func() {
		err := f()
		select {
		case errs <- err:
		default:
			if tmFunc != nil {
				tmFunc(err)
			}
		}
	}()
	select {
	case err := <-errs:
		return err
	case <-time.After(timeout):
		return errors.New("operation timeout")
	}
}
943615
func (a *EvaluateOnCallFrameArgs) SetTimeout(timeout runtime.TimeDelta) *EvaluateOnCallFrameArgs {
	a.Timeout = &timeout
	return a
}
589333
func (v *Duration) Add(delta time.Duration) {
	v.i.Add(delta)
}
499498
func (ini *Init) AddWithTimeout(timeout time.Duration, f func(ctx context.Context) (interface{}, error)) *Init {
	return ini.Add(func() (interface{}, error) {
		return ini.withTimeout(timeout, f)
	})
}
1073155
func (r *request) SetTimeout(timeout time.Duration) error {
	r.timeout = timeout
	return nil
}
646915
func FunctionTimeout(fn func() error, timeout time.Duration) error {
	c := make(chan error, 1)
	go func() {
		c <- fn()
	}()
	select {
	case err := <-c:
		return err
	case <-time.After(timeout):
		return errors.New("timeout")
	}
}
579056
func (s *StartJobRunInput) SetTimeout(v int64) *StartJobRunInput {
	s.Timeout = &v
	return s
}
880735
func (r *SubReply) Timeout() bool {
	if r.Err == nil {
		return false
	}
	t, ok := r.Err.(*net.OpError)
	return ok && t.Timeout()
}
14700
func Augment(root Markup, m ...Markup) {
	if el, ok := root.(*Element); ok {
		for _, mo := range m {
			mo.Apply(el)
		}
	}
}