第一版时间轮任务调度实现 #1

Merged
zhangdeman merged 15 commits from feature/timewheel into master 2023-09-04 20:13:17 +08:00
4d9cb375ec slotCount和interval增加默认值
白茶清欢
2023-08-11 18:18:00 +08:00
Commit 11 of 15
Show all commits
+8
View File
@@ -21,6 +21,14 @@ import (
//
// Date : 16:50 2023/8/11
func NewTimeWheel(slotCount int, interval time.Duration) *TimeWheel {
if slotCount <= 0 {
// 默认100个槽位
slotCount = 100
}
if interval.Seconds() == 0 {
// 默认60s扫描一次
interval = time.Second * 60
}
tw := &TimeWheel{
Interval: interval,
Slots: make([]*list.List, slotCount),
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.