func NewTimeWheel(tick time.Duration, bucketsNum int) (*TimeWheel, error) {
	if bucketsNum <= 0 {
		return nil, errors.New("bucket number must be greater than 0")
	}
	if int(tick.Seconds()) < 1 {
		return nil, errors.New("tick cannot be less than 1s")
	}
	tw := &TimeWheel{
		tick:          tick,
		bucketsNum:    bucketsNum,
		bucketIndexes: make(map[interface{}]int, 1024),
		buckets:       make([]map[interface{}]*Task, bucketsNum),
		currentIndex:  0,
		addC:          make(chan *Task, 1024),
		removeC:       make(chan interface{}, 1024),
		stopC:         make(chan struct{}),
	}
	for i := 0; i < bucketsNum; i++ {
		tw.buckets[i] = make(map[interface{}]*Task, 16)
	}
	return tw, nil
}
NewTimeWheel create new time wheel
package util
import (
	"errors"
	"time"
)
type Task struct {
	delay    time.Duration
	key      interface{}
	round    int  
	callback func()
}
type TimeWheel struct {
	tick   time.Duration
	ticker *time.Ticker
	bucketsNum    int
	buckets       []map[interface{}]*Task  
	bucketIndexes map[interface{}]int      
	currentIndex int
	addC    chan *Task
	removeC chan interface{}
	stopC   chan struct{}
}