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