mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
优化定时器
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package timer
|
package timer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -169,7 +168,6 @@ func (disp *Dispatcher) CronFunc(cronExpr *CronExpr, cb func(*Cron),onTimerClose
|
|||||||
cron.name = funcName
|
cron.name = funcName
|
||||||
cron.interval = nextTime.Sub(now)
|
cron.interval = nextTime.Sub(now)
|
||||||
cron.fireTime = Now().Add(cron.interval)
|
cron.fireTime = Now().Add(cron.interval)
|
||||||
fmt.Println(cron.interval.Milliseconds(),"\n")
|
|
||||||
SetupTimer(&cron.Timer)
|
SetupTimer(&cron.Timer)
|
||||||
onAddTimer(&cron.Timer)
|
onAddTimer(&cron.Timer)
|
||||||
return cron
|
return cron
|
||||||
|
|||||||
Reference in New Issue
Block a user