diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-06-21 17:44:57 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-06-21 17:44:57 +0300 |
commit | 10dfb15d567beb35fd4e2beeba5e6d375edd3d3f (patch) | |
tree | 3c93a421fa5516ca46a13a220d7e1521fdd7a01f /internal/vfs | |
parent | dec68447bfc3c3a90bc3beeaf80aad03daa22e21 (diff) | |
parent | f684ffa6fbe79845e3574b22987cb4b081f842ec (diff) |
Merge branch 'jv-clear-timezone' into 'master'
Clear timezones from cached zip entries
See merge request gitlab-org/gitlab-pages!791
Diffstat (limited to 'internal/vfs')
-rw-r--r-- | internal/vfs/zip/archive.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go index 0a9ac0d7..49ae2719 100644 --- a/internal/vfs/zip/archive.go +++ b/internal/vfs/zip/archive.go @@ -148,6 +148,13 @@ func (a *zipArchive) readArchive(url string) { continue } + // Each Modified timestamp contains a pointer to a unique timezone + // object. This wastes a lot of memory. By setting the timezone to UTC on + // each timestamp, we allow the unique timezone objects to be + // garbage-collected. Also see + // https://gitlab.com/gitlab-org/gitlab-pages/-/issues/702. + file.Modified = file.Modified.UTC() + if file.Mode().IsDir() { a.directories[file.Name] = &file.FileHeader } else { |