mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 16:49:03 +01:00
refactor: improve task management with xsync for concurrent access and enhance callback and subtasks handling as well as memory allocation
This commit is contained in:
27
internal/task/task_debug.go
Normal file
27
internal/task/task_debug.go
Normal file
@@ -0,0 +1,27 @@
|
||||
//go:build debug
|
||||
|
||||
package task
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func panicWithDebugStack() {
|
||||
panic(string(debug.Stack()))
|
||||
}
|
||||
|
||||
func panicIfFinished(t *Task, reason string) {
|
||||
if t.isFinished() {
|
||||
log.Panic().Msg("task " + t.String() + " is finished but " + reason)
|
||||
}
|
||||
}
|
||||
|
||||
func logStarted(t *Task) {
|
||||
log.Info().Msg("task " + t.String() + " started")
|
||||
}
|
||||
|
||||
func logFinished(t *Task) {
|
||||
log.Info().Msg("task " + t.String() + " finished")
|
||||
}
|
||||
Reference in New Issue
Block a user