timingwheel icon indicating copy to clipboard operation
timingwheel copied to clipboard

允许替换任务执行方式

Open yeaha opened this issue 1 year ago • 0 comments

提供SetTaskRunner()方法,允许自行实现任务具体的执行方式

例如可以使用goroutine pool进一步提高并发执行效率

import (
  "github.com/panjf2000/ants"
  "github.com/RussellLuo/timingwheel"
)

func init() {
  timingwheel.SetTaskRunner(func(task func()) {
    ants.Submit(task)
  })
}

yeaha avatar Mar 10 '23 09:03 yeaha