Skip to content

Commit 540a0e6

Browse files
committed
fix panic in randomDuration when min equals max
1 parent 3f66b7a commit 540a0e6

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)