diff options
author | zeripath <art27@cantab.net> | 2021-10-08 14:08:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 15:08:22 +0200 |
commit | 001dbf100de40f19c7ade5b8f013fbcccbe09ec3 (patch) | |
tree | 0b1a57f8efbb2e941fe4c344005a70ec76ad57d1 /routers/web/web.go | |
parent | 88fa9f3fb168bc6c9c2bdc6341b83bc048b38846 (diff) | |
download | gitea-001dbf100de40f19c7ade5b8f013fbcccbe09ec3.tar.gz gitea-001dbf100de40f19c7ade5b8f013fbcccbe09ec3.zip |
Defer Last Commit Info (#16467)
One of the biggest reasons for slow repository browsing is that we wait
until last commit information has been generated for all files in the
repository.
This PR proposes deferring this generation to a new POST endpoint that
does the look up outside of the main page request.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/web/web.go')
-rw-r--r-- | routers/web/web.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/routers/web/web.go b/routers/web/web.go index e12552f4d4..01d90d206f 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -995,6 +995,9 @@ func RegisterRoutes(m *web.Route) { m.Get("/commit/{sha:([a-f0-9]{7,40})}.{ext:patch|diff}", repo.MustBeNotEmpty, reqRepoCodeReader, repo.RawDiff) }, ignSignIn, context.RepoAssignment, context.UnitTypes()) + + m.Post("/{username}/{reponame}/lastcommit/*", ignSignInAndCsrf, context.RepoAssignment, context.UnitTypes(), context.RepoRefByType(context.RepoRefCommit), reqRepoCodeReader, repo.LastCommit) + m.Group("/{username}/{reponame}", func() { m.Get("/stars", repo.Stars) m.Get("/watchers", repo.Watchers) |