Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2020-10-06 09:34:41 +0300
committerKamil TrzciƄski <ayufan@ayufan.eu>2020-10-13 00:13:32 +0300
commit61acef8cafafbab2bf1689a97fecddddbd726152 (patch)
treec3f6c0be4c97c594cbb8db489087594dace72faa
parentde9d20dc6195127d1e01e41cccb1441ee6445116 (diff)
Reduce the number of items to prune
-rw-r--r--internal/vfs/zip/archive.go1
-rw-r--r--internal/vfs/zip/vfs.go2
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{}) {