diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-12-20 12:17:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-20 12:17:14 +0800 |
commit | 52b319bc00712da095ee4121b616be232b1e455b (patch) | |
tree | e509235780bab858e43023247f82d1c956c71bf1 /modules/queue/workerqueue.go | |
parent | c66de245c4603c8426273f98af1a0c4d2855a677 (diff) | |
download | gitea-52b319bc00712da095ee4121b616be232b1e455b.tar.gz gitea-52b319bc00712da095ee4121b616be232b1e455b.zip |
Refactor pprof labels and process desc (#32909)
* Deprecate "gopid" in log, it is not useful and requires very hacky
approach
* Remove "git.Command.SetDescription" because it is not useful and only
makes the logs too flexible
Diffstat (limited to 'modules/queue/workerqueue.go')
-rw-r--r-- | modules/queue/workerqueue.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/queue/workerqueue.go b/modules/queue/workerqueue.go index 672e9a4114..0f5b105551 100644 --- a/modules/queue/workerqueue.go +++ b/modules/queue/workerqueue.go @@ -6,6 +6,7 @@ package queue import ( "context" "fmt" + "runtime/pprof" "sync" "sync/atomic" "time" @@ -241,6 +242,9 @@ func NewWorkerPoolQueueWithContext[T any](ctx context.Context, name string, queu w.origHandler = handler w.safeHandler = func(t ...T) (unhandled []T) { defer func() { + // FIXME: there is no ctx support in the handler, so process manager is unable to restore the labels + // so here we explicitly set the "queue ctx" labels again after the handler is done + pprof.SetGoroutineLabels(w.ctxRun) err := recover() if err != nil { log.Error("Recovered from panic in queue %q handler: %v\n%s", name, err, log.Stack(2)) |