From 77a733b8af393f81c1143ca27324384b1801a090 Mon Sep 17 00:00:00 2001 From: feistel <6742251-feistel@users.noreply.gitlab.com> Date: Mon, 26 Jul 2021 15:30:26 +0000 Subject: refactor: read and use file_sha256 as cache key for zip VFS Now that the Rails API is serving the archive file_sha256 in the lookup response, we can move away from using the base URL as the key to cache the archive. Changelog: change --- internal/vfs/vfs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/vfs/vfs.go') diff --git a/internal/vfs/vfs.go b/internal/vfs/vfs.go index 40fe8bc7..a93f9e26 100644 --- a/internal/vfs/vfs.go +++ b/internal/vfs/vfs.go @@ -13,7 +13,7 @@ import ( // VFS abstracts the things Pages needs to serve a static site from disk. type VFS interface { - Root(ctx context.Context, path string) (Root, error) + Root(ctx context.Context, path string, cacheKey string) (Root, error) Name() string Reconfigure(config *config.Config) error } @@ -34,8 +34,8 @@ func (i *instrumentedVFS) log(ctx context.Context) *logrus.Entry { return log.ContextLogger(ctx).WithField("vfs", i.fs.Name()) } -func (i *instrumentedVFS) Root(ctx context.Context, path string) (Root, error) { - root, err := i.fs.Root(ctx, path) +func (i *instrumentedVFS) Root(ctx context.Context, path string, cacheKey string) (Root, error) { + root, err := i.fs.Root(ctx, path, cacheKey) i.increment("Root", err) i.log(ctx). -- cgit v1.2.3