diff options
author | Alec Warner <antarus@gentoo.org> | 2023-01-03 11:58:21 -0800 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2023-01-03 11:58:21 -0800 |
commit | 44adda6507e658aca13ed5bd7d945d52c29191e9 (patch) | |
tree | 14a22e453f6e43a7a51f5581a7f85a8ea8050ba2 /web | |
parent | Use whitespace eliding to avoid generating a large response. (diff) | |
download | soko-44adda6507e658aca13ed5bd7d945d52c29191e9.tar.gz soko-44adda6507e658aca13ed5bd7d945d52c29191e9.tar.bz2 soko-44adda6507e658aca13ed5bd7d945d52c29191e9.zip |
Stop loop iteration once we are done displaying.
Previously if "modified" was 19701 files, we would loop 19701 times, but
only emit 100 lines; the other loop iterations were not doing anything.
Now we break early once we hit the limit (50 or 100, depending.)
it does not solve the underlying problem (of text/template just emitting
loads of undesired whitespace) but it quickly solves *this* problem..I
think (of the changelog being 20MB.)
Signed-off-by: Alec Warner <antarus@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r-- | web/templates/packages/changelog/changelog.tmpl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/web/templates/packages/changelog/changelog.tmpl b/web/templates/packages/changelog/changelog.tmpl index ad0b2a9..8c8fcbe 100644 --- a/web/templates/packages/changelog/changelog.tmpl +++ b/web/templates/packages/changelog/changelog.tmpl @@ -27,7 +27,7 @@ <div class="col-md-12"> {{$commit := .}} {{range $key, $value := .ChangedFiles.Added }} - {{-if le $key 100 -}} + {{-if gt $key 100 -}} {{- break -}} {{ if contains .Path (print $.Atom "/")}} <style> .kk-added-file-badge { @@ -43,7 +43,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Modified }} - {{- if le $key 100 -}} + {{- if gt $key 100 -}} {{- break -}} {{ if contains $value.Path (print $.Atom "/")}} <style> .kk-modified-file-badge { @@ -59,7 +59,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Deleted }} - {{- if le $key 100 -}} + {{- if gt $key 100 -}} {{- break -}} {{ if contains .Path (print $.Atom "/")}} <style> .kk-deleted-file-badge { @@ -104,7 +104,7 @@ <div class="col-md-12"> {{$commit := .}} {{range $key, $value := .ChangedFiles.Added }} - {{- if le $key 50 -}} + {{- if gt $key 50 -}} {{- break -}} {{ if contains $value.Path (print $.Atom "/")}} <style> .kk-added-file-badge { @@ -120,7 +120,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Modified }} - {{- if le $key 50 -}} + {{- if gt $key 50 -}} {{- break -}} {{ if contains $value.Path (print $.Atom "/")}} <style> .kk-modified-file-badge { @@ -136,7 +136,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Deleted }} - {{- if le $key 50 -}} + {{- if gt $key 50 -}} {{- break -}} {{ if contains .Path (print $.Atom "/")}} <style> .kk-deleted-file-badge { |