#1245 增加调试日志

Merged
lewis merged 3 commits from fix-1231 into V20211228.patch 2 years ago
  1. +8
    -0
      modules/context/repo.go
  2. +5
    -0
      routers/repo/issue.go

+ 8
- 0
modules/context/repo.go View File

@@ -11,6 +11,7 @@ import (
"net/url"
"path"
"strings"
"time"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/cache"
@@ -517,6 +518,7 @@ func RepoAssignment() macaron.Handler {
return
}

startTime := time.Now()
tags, err := ctx.Repo.GitRepo.GetTags()
if err != nil {
ctx.ServerError("GetTags", err)
@@ -524,11 +526,17 @@ func RepoAssignment() macaron.Handler {
}
ctx.Data["Tags"] = tags

duration := time.Since(startTime)
log.Info("GetTags cost: %v seconds", duration.Seconds())
brs, _, err := ctx.Repo.GitRepo.GetBranches(0, 0)
if err != nil {
ctx.ServerError("GetBranches", err)
return
}

duration = time.Since(startTime)
log.Info("GetBranches cost: %v seconds", duration.Seconds())

ctx.Data["Branches"] = brs
ctx.Data["BranchesCount"] = len(brs)



+ 5
- 0
routers/repo/issue.go View File

@@ -13,6 +13,7 @@ import (
"net/http"
"strconv"
"strings"
"time"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
@@ -336,6 +337,7 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB

// Issues render issues page
func Issues(ctx *context.Context) {
startTime := time.Now()
isPullList := ctx.Params(":type") == "pulls"
if isPullList {
MustAllowPulls(ctx)
@@ -366,6 +368,9 @@ func Issues(ctx *context.Context) {

ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList)

duration := time.Since(startTime)
log.Info("Issues cost: %v seconds", duration.Seconds())

ctx.HTML(200, tplIssues)
}



Loading…
Cancel
Save