summaryrefslogtreecommitdiffstats
path: root/modules/web
diff options
context:
space:
mode:
Diffstat (limited to 'modules/web')
-rw-r--r--modules/web/routing/logger_manager.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/web/routing/logger_manager.go b/modules/web/routing/logger_manager.go
index cc434c338d..7715b0b5d3 100644
--- a/modules/web/routing/logger_manager.go
+++ b/modules/web/routing/logger_manager.go
@@ -11,6 +11,7 @@ import (
"time"
"code.gitea.io/gitea/modules/graceful"
+ "code.gitea.io/gitea/modules/process"
)
// Event indicates when the printer is triggered
@@ -40,7 +41,9 @@ type requestRecordsManager struct {
}
func (manager *requestRecordsManager) startSlowQueryDetector(threshold time.Duration) {
- go graceful.GetManager().RunWithShutdownContext(func(baseCtx context.Context) {
+ go graceful.GetManager().RunWithShutdownContext(func(ctx context.Context) {
+ ctx, _, finished := process.GetManager().AddTypedContext(ctx, "Service: SlowQueryDetector", process.SystemProcessType, true)
+ defer finished()
// This go-routine checks all active requests every second.
// If a request has been running for a long time (eg: /user/events), we also print a log with "still-executing" message
// After the "still-executing" log is printed, the record will be removed from the map to prevent from duplicated logs in future
@@ -49,7 +52,7 @@ func (manager *requestRecordsManager) startSlowQueryDetector(threshold time.Dura
t := time.NewTicker(time.Second)
for {
select {
- case <-baseCtx.Done():
+ case <-ctx.Done():
return
case <-t.C:
now := time.Now()