a685e3fc98
Vndr has a simpler configuration and allows pointing to forked packages. Additionally other docker projects are now using vndr making vendoring in distribution more consistent. Updates letsencrypt to use fork. No longer uses sub-vendored packages. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
29 lines
496 B
Go
29 lines
496 B
Go
package acme
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// WaitFor polls the given function 'f', once every 'interval', up to 'timeout'.
|
|
func WaitFor(timeout, interval time.Duration, f func() (bool, error)) error {
|
|
var lastErr string
|
|
timeup := time.After(timeout)
|
|
for {
|
|
select {
|
|
case <-timeup:
|
|
return fmt.Errorf("Time limit exceeded. Last error: %s", lastErr)
|
|
default:
|
|
}
|
|
|
|
stop, err := f()
|
|
if stop {
|
|
return nil
|
|
}
|
|
if err != nil {
|
|
lastErr = err.Error()
|
|
}
|
|
|
|
time.Sleep(interval)
|
|
}
|
|
}
|