go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

TimingWheel:numSlots

Open szmgfcsp opened this issue 3 years ago • 1 comments
trafficstars

`type ( // Execute defines the method to execute the task. Execute func(key, value interface{})

// A TimingWheel is a timing wheel object to schedule tasks.
TimingWheel struct {
	interval      time.Duration
	ticker        timex.Ticker
	slots         []*list.List
	timers        *SafeMap
	tickedPos     int
	numSlots      int
	execute       Execute
	setChannel    chan timingEntry
	moveChannel   chan baseEntry
	removeChannel chan interface{}
	drainChannel  chan func(key, value interface{})
	stopChannel   chan lang.PlaceholderType
}

timingEntry struct {
	baseEntry
	value   interface{}
	circle  int
	diff    int
	removed bool
}

baseEntry struct {
	delay time.Duration
	key   interface{}
}

positionEntry struct {
	pos  int
	item *timingEntry
}

timingTask struct {
	key   interface{}
	value interface{}
}

)`

时间轮的numSlots具体什么含义,设置多大合适,能否自动适配,感谢

szmgfcsp avatar Sep 07 '22 03:09 szmgfcsp

Will work on it to auto tune the parameter numSlots.

kevwan avatar Sep 11 '22 15:09 kevwan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Mar 14 '24 01:03 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 18 '24 01:06 github-actions[bot]