fix: 修复 #58 taskType 及事件被遗漏的问题

This commit is contained in:
kercylan98 2023-10-26 09:34:19 +08:00
parent fb5dacb4b4
commit 9f882651eb
1 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import (
func NewTask(id int64, taskType int, condition int64, options ...Option) *Task {
task := &Task{
id: id,
taskType: taskType,
condition: condition,
state: StateAccept,
}
@ -181,11 +182,13 @@ func (slf *Task) SetChildCount(key any, count int64) {
}
slf.childCount[key] = count
slf.refreshState()
OnRefreshTaskCount(slf.taskType, count)
}
// AddChildCount 增加子计数
func (slf *Task) AddChildCount(key any, count int64) {
slf.SetChildCount(key, slf.childCount[key]+count)
OnRefreshTaskChildCount(slf.taskType, key, count)
}
// refreshState 刷新任务状态