Skip to content

Commit c64aef7

Browse files
pdoernerstephanos
authored andcommitted
Reduce max proto duration cap to 100 years (#7510)
## What changed? Reduced max proto duration cap from 250 to 100 years. ## Why? ElasticSearch can only handle datetimes up to ~2262 ## How did you test it? Existing tests
1 parent 111f556 commit c64aef7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/primitives/timestamp/duration.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ import (
3131
"google.golang.org/protobuf/types/known/durationpb"
3232
)
3333

34-
// 250 years. Maximum representable golang time.Duration is approximately 290 years (INT64_MAX * time.Nanosecond)
35-
const maxAllowedDuration = 250 * 365 * 24 * time.Hour
34+
// 100 years. Maximum representable golang time.Duration is approximately 290 years (INT64_MAX * time.Nanosecond)
35+
// ElasticSearch only supports datetimes up to 2262, so cap at 100 years to be safe.
36+
const maxAllowedDuration = 100 * 365 * 24 * time.Hour
3637

3738
var (
3839
errNegativeDuration = fmt.Errorf("negative duration")

0 commit comments

Comments
 (0)