Mercurial > gemma
diff pkg/common/attributes.go @ 1985:8eeb0b5eb340
Imports: Made retries and the waiting between the attempts configurable.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 23 Jan 2019 17:58:57 +0100 |
parents | 49e047c2106e |
children | 74e24ae3205a |
line wrap: on
line diff
--- a/pkg/common/attributes.go Wed Jan 23 16:25:43 2019 +0100 +++ b/pkg/common/attributes.go Wed Jan 23 17:58:57 2019 +0100 @@ -67,3 +67,16 @@ } return i, true } + +func (ca Attributes) Duration(key string) (time.Duration, bool) { + s, found := ca.Get(key) + if !found { + return 0, false + } + d, err := time.ParseDuration(s) + if err != nil { + log.Printf("error: %v\n", err) + return 0, false + } + return d, true +}