mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-27 11:51:53 +01:00
task package: replace waitgroup with channel, fix stuck
This commit is contained in:
26
internal/task/debug.go
Normal file
26
internal/task/debug.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package task
|
||||
|
||||
import "strings"
|
||||
|
||||
// debug only.
|
||||
func (t *Task) listChildren() []string {
|
||||
var children []string
|
||||
allTasks.Range(func(child *Task) bool {
|
||||
if child.parent == t {
|
||||
children = append(children, strings.TrimPrefix(child.name, t.name+"."))
|
||||
}
|
||||
return true
|
||||
})
|
||||
return children
|
||||
}
|
||||
|
||||
// debug only.
|
||||
func (t *Task) listCallbacks() []string {
|
||||
var callbacks []string
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
for c := range t.callbacks {
|
||||
callbacks = append(callbacks, c.about)
|
||||
}
|
||||
return callbacks
|
||||
}
|
||||
Reference in New Issue
Block a user