Skip to content

Commit 9b6f6c4

Browse files
authored
Merge pull request #2570 from CortexFoundation/dev
fix panic in randomDuration when min equals max
2 parents 7a37a54 + 540a0e6 commit 9b6f6c4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ctxc/dropper.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ func randomDuration(min, max time.Duration) time.Duration {
145145
if min > max {
146146
panic("min duration must be less than or equal to max duration")
147147
}
148+
if min == max {
149+
return min
150+
}
148151
return time.Duration(mrand.Int63n(int64(max-min)) + int64(min))
149152
}
150153

0 commit comments

Comments
 (0)