mirror of
https://github.com/xtaci/kcp-go.git
synced 2024-04-21 12:32:15 +00:00
optimize on timedsched
This commit is contained in:
+1
-2
@@ -74,9 +74,8 @@ func (ts *TimedSched) sched() {
|
||||
// reset timer to trigger based on the top element
|
||||
timer.Reset(tasks[0].ts.Sub(now))
|
||||
}
|
||||
case <-timer.C:
|
||||
case now := <-timer.C:
|
||||
for tasks.Len() > 0 {
|
||||
now := time.Now()
|
||||
if now.After(tasks[0].ts) {
|
||||
heap.Pop(&tasks).(timedFunc).execute()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user