Browse Source

解决调试问题

pull/1/head
Sydonian 2 years ago
parent
commit
cad8958c8f
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      pkg/tickevent/executor.go

+ 2
- 1
pkg/tickevent/executor.go View File

@@ -1,6 +1,7 @@
package tickevent

import (
"math/rand"
"sync/atomic"
"time"
)
@@ -48,7 +49,7 @@ func (e *Executor[TArgs]) Start(event TickEvent[TArgs], intervalMs int, opts ...

go func() {
if opt.RandomStartDelayMs > 0 {
<-time.After(time.Duration(opt.RandomStartDelayMs) * time.Millisecond)
<-time.After(time.Duration(rand.Intn(opt.RandomStartDelayMs)) * time.Millisecond)
}

timeTicker := time.NewTicker(time.Duration(intervalMs) * time.Millisecond)


Loading…
Cancel
Save