fix(config): handles raw nanoseconds durations
Cadoles/bouncer/pipeline/head This commit looks good
Details
Cadoles/bouncer/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3e98901931
commit
2952f68720
|
@ -205,10 +205,15 @@ func (id *InterpolatedDuration) UnmarshalYAML(value *yaml.Node) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
duration, err := time.ParseDuration(str)
|
duration, err := time.ParseDuration(str)
|
||||||
|
if err != nil {
|
||||||
|
nanoseconds, err := strconv.ParseInt(str, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "could not parse duration '%v', line '%d'", str, value.Line)
|
return errors.Wrapf(err, "could not parse duration '%v', line '%d'", str, value.Line)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duration = time.Duration(nanoseconds)
|
||||||
|
}
|
||||||
|
|
||||||
*id = InterpolatedDuration(duration)
|
*id = InterpolatedDuration(duration)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue