- RefreshAllStoresID

- RefreshAllSkusID
- use new tasksch when possible(not use run directly).
This commit is contained in:
gazebo
2018-10-23 16:34:42 +08:00
parent ad3d548824
commit 93a7202423
18 changed files with 323 additions and 155 deletions

View File

@@ -193,7 +193,7 @@ func (task *ParallelTask) Run() {
})
}
func (t *ParallelTask) AddChild(task ITask) {
t.BaseTask.AddChild(task)
func (t *ParallelTask) AddChild(task ITask) ITask {
task.SetParent(t)
return t.BaseTask.AddChild(task)
}

View File

@@ -76,7 +76,7 @@ func (task *SeqTask) Run() {
})
}
func (t *SeqTask) AddChild(task ITask) {
t.BaseTask.AddChild(task)
func (t *SeqTask) AddChild(task ITask) ITask {
task.SetParent(t)
return t.BaseTask.AddChild(task)
}

View File

@@ -36,7 +36,7 @@ type ITask interface {
GetStatus() int
GetCreatedAt() time.Time
AddChild(task ITask)
AddChild(task ITask) ITask
GetChildren() TaskList
SetParent(parentTask ITask)
@@ -182,11 +182,12 @@ func (t *BaseTask) GetStatus() int {
return t.Status
}
func (t *BaseTask) AddChild(task ITask) {
func (t *BaseTask) AddChild(task ITask) ITask {
t.locker.Lock()
defer t.locker.Unlock()
t.Children = append(t.Children, task)
return task
}
func (t *BaseTask) GetChildren() (children TaskList) {