Skip to content

Commit

Permalink
Merge pull request #999 from qazwsxedckll/dev
Browse files Browse the repository at this point in the history
fix: d less than 1 ms should not panic
  • Loading branch information
rogeralsing authored Dec 21, 2023
2 parents 5ced9c2 + ed0c669 commit 43f5090
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions actor/actor_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,15 @@ func (ctx *actorContext) Unwatch(who *PID) {
}

func (ctx *actorContext) SetReceiveTimeout(d time.Duration) {
if d <= 0 {
panic("Duration must be greater than zero")
if d < time.Millisecond {
// anything less than 1 millisecond is set to zero
d = 0
}

if d == ctx.receiveTimeout {
return
}

if d < time.Millisecond {
// anything less than 1 millisecond is set to zero
d = 0
}

ctx.receiveTimeout = d

ctx.ensureExtras()
Expand Down

0 comments on commit 43f5090

Please sign in to comment.