aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGusted2022-02-27 17:51:34 +0000
committerGitHub2022-02-27 18:51:34 +0100
commit548adb94b4435b1304151150aa926f09a7a62255 (patch)
treeef988a2294cbd707707391b4a93f0787e1f4715b
parent79c7219be8be1303922e3090c9011aab9c6a3519 (diff)
Avoid database lookups for `DescriptionHTML` (#18924)
* Avoid database lookups for `DescriptionHTML` - Don't Compose meta's for DescriptionHTML, they are only needed in order to correctly format and show issue's but it's highly unlikely that a repository description will refer to a local issue. Using 125 Connections for 5 seconds: on `/explore/repos`(which is the most noticeable usage by this function's database lookups): Before: Statistics Avg Stdev Max Reqs/sec 569.41 506.05 2715.00 Latency 214.27ms 16.60ms 294.84ms HTTP codes: 1xx - 0, 2xx - 2974, 3xx - 0, 4xx - 0, 5xx - 0 others - 0 Throughput: 27.17MB/s After: Statistics Avg Stdev Max Reqs/sec 1585.04 789.84 4144.56 Latency 78.89ms 15.89ms 206.94ms HTTP codes: 1xx - 0, 2xx - 7975, 3xx - 0, 4xx - 0, 5xx - 0 others - 0 Throughput: 73.85MB/s Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
-rw-r--r--models/repo/repo.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/repo/repo.go b/models/repo/repo.go
index 156ead405..f5b93d6da 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -520,7 +520,7 @@ func (repo *Repository) DescriptionHTML(ctx context.Context) template.HTML {
desc, err := markup.RenderDescriptionHTML(&markup.RenderContext{
Ctx: ctx,
URLPrefix: repo.HTMLURL(),
- Metas: repo.ComposeMetas(),
+ // Don't use Metas to speedup requests
}, repo.Description)
if err != nil {
log.Error("Failed to render description for %s (ID: %d): %v", repo.Name, repo.ID, err)