feat(event): feat the function of getting the queue length

This commit is contained in:
HuangJiaLuo 2021-10-09 22:05:39 +08:00
parent a251cdb844
commit 843fcd27ca
2 changed files with 3 additions and 7 deletions

View File

@ -18,7 +18,7 @@ type EventWorkFunc func() (interface{}, error)
type DriverInterface interface {
Get() *Event
Put(event *Event)
GetLengthJudge() bool
GetLength() int
}
type ProduceInterface interface {

View File

@ -137,12 +137,8 @@ func (d *Driver) Put(event *Event) {
d.queue <- event
}
func (d *Driver) GetLengthJudge() bool {
// 自动对当前的最大io数量进行判断
if len(d.queue) > d.maxQueueSize * 1/2{
return true
}
return false
func (d *Driver) GetLength() int {
return len(d.queue)
}
// NewDriver 新建 Driver