resources/images: Make the image cache more robust

Also allow timeout to be set as a duration string, e.g. `30s`.

Fixes #6501
This commit is contained in:
Bjørn Erik Pedersen 2019-11-25 12:49:04 +01:00
parent 031f948f87
commit d6f7a9e28d
11 changed files with 85 additions and 32 deletions

View file

@ -64,7 +64,7 @@ func (ini *Init) Branch(initFn func() (interface{}, error)) *Init {
}
// BranchdWithTimeout is same as Branch, but with a timeout.
func (ini *Init) BranchdWithTimeout(timeout time.Duration, f func(ctx context.Context) (interface{}, error)) *Init {
func (ini *Init) BranchWithTimeout(timeout time.Duration, f func(ctx context.Context) (interface{}, error)) *Init {
return ini.Branch(func() (interface{}, error) {
return ini.withTimeout(timeout, f)
})