From caf2b13c10f912bef00dbab98cb1ed232aa5854c Mon Sep 17 00:00:00 2001 From: bnorick Date: Tue, 13 Feb 2024 15:40:32 -0800 Subject: [PATCH] Fix infinite keep_alive (#2480) --- api/types.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/types.go b/api/types.go index 609c4a8a1..9a9efdcd0 100644 --- a/api/types.go +++ b/api/types.go @@ -415,8 +415,7 @@ func (d *Duration) UnmarshalJSON(b []byte) (err error) { switch t := v.(type) { case float64: if t < 0 { - t = math.MaxFloat64 - d.Duration = time.Duration(t) + d.Duration = time.Duration(math.MaxInt64) } else { d.Duration = time.Duration(t * float64(time.Second)) } @@ -426,8 +425,7 @@ func (d *Duration) UnmarshalJSON(b []byte) (err error) { return err } if d.Duration < 0 { - mf := math.MaxFloat64 - d.Duration = time.Duration(mf) + d.Duration = time.Duration(math.MaxInt64) } }