diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-10-06 09:34:41 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2020-10-13 00:13:32 +0300 |
commit | 61acef8cafafbab2bf1689a97fecddddbd726152 (patch) | |
tree | c3f6c0be4c97c594cbb8db489087594dace72faa | |
parent | de9d20dc6195127d1e01e41cccb1441ee6445116 (diff) |
Reduce the number of items to prune
-rw-r--r-- | internal/vfs/zip/archive.go | 1 | ||||
-rw-r--r-- | internal/vfs/zip/vfs.go | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go index f602d750..74a73121 100644 --- a/internal/vfs/zip/archive.go +++ b/internal/vfs/zip/archive.go @@ -187,6 +187,7 @@ func (a *zipArchive) Open(ctx context.Context, name string) (vfs.File, error) { func (a *zipArchive) getDataOffset(name string, file *zip.File) (int64, error) { var dataOffset int64 + item := a.fs.dataOffsetCache.Get(a.cacheKey + name) if item == nil || item.Expired() { var err error diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go index 9b90c6bf..a39a1cfe 100644 --- a/internal/vfs/zip/vfs.go +++ b/internal/vfs/zip/vfs.go @@ -39,7 +39,7 @@ func New() vfs.VFS { // TODO: add cache operation callbacks https://gitlab.com/gitlab-org/gitlab-pages/-/issues/465 cache: cache.New(defaultCacheExpirationInterval, defaultCacheCleanupInterval), dataOffsetCache: ccache.New(ccache.Configure().MaxSize(10000).ItemsToPrune(2000)), - readlinkCache: ccache.New(ccache.Configure().MaxSize(1000).ItemsToPrune(2000)), + readlinkCache: ccache.New(ccache.Configure().MaxSize(1000).ItemsToPrune(200)), } zipVFS.cache.OnEvicted(func(s string, i interface{}) { |