forked from juju/juju
/
polling.go
32 lines (27 loc) · 935 Bytes
/
polling.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package common
import (
"time"
"github.com/juju/utils"
)
// Use ShortAttempt to poll for short-term events.
// TODO: This may need tuning for different providers (or even environments).
//
// TODO(katco): 2016-08-09: lp:1611427
var ShortAttempt = utils.AttemptStrategy{
Total: 5 * time.Second,
Delay: 200 * time.Millisecond,
}
// A request may fail to due "eventual consistency" semantics, which
// should resolve fairly quickly. These delays are specific to the provider
// and best tuned there.
// Other requests fail due to a slow state transition (e.g. an instance taking
// a while to release a security group after termination). If you need to
// poll for the latter kind, use LongAttempt.
//
// TODO(katco): 2016-08-09: lp:1611427
var LongAttempt = utils.AttemptStrategy{
Total: 3 * time.Minute,
Delay: 1 * time.Second,
}