diff options
author | Stan Hu <stanhu@gmail.com> | 2022-07-23 10:17:38 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2022-07-23 10:33:08 +0300 |
commit | e34ed022accdff134d7464de03069670c0e18aaf (patch) | |
tree | 2bd03e4d3424c5668447c3cac687b0bc5361c7fd | |
parent | a80c58682c3c313f52deecdebecfef2d1f7e3b21 (diff) |
Chore: log ZIP archive corruption errorsh-log-zfs-corruption-error
When a ZIP file cannot be opened for some reason, we previously would
discard the error after attempting to retrieve it from the
cache. While this error is logged in another message, it would be
helpful to have the same message tied with the "archive corrupted" log
entry.
Relates to https://gitlab.com/gitlab-org/gitlab-pages/-/issues/690
Changelog: changed
-rw-r--r-- | internal/vfs/zip/vfs.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go index b87b7822..6b42e627 100644 --- a/internal/vfs/zip/vfs.go +++ b/internal/vfs/zip/vfs.go @@ -188,7 +188,7 @@ func (zfs *zipVFS) findOrCreateArchive(key string) (*zipArchive, error) { archive, expiry, found := zfs.cache.GetWithExpiration(key) if found { - status, _ := archive.(*zipArchive).openStatus() + status, zipErr := archive.(*zipArchive).openStatus() switch status { case archiveOpening: metrics.ZipCacheRequests.WithLabelValues("archive", "hit-opening").Inc() @@ -209,7 +209,7 @@ func (zfs *zipVFS) findOrCreateArchive(key string) (*zipArchive, error) { case archiveCorrupted: // this means that archive is likely changed // we should invalidate it immediately - log.WithFields(log.Fields{ + log.WithError(zipErr).WithFields(log.Fields{ "archive_key": key, }).Error("archive corrupted") metrics.ZipCacheRequests.WithLabelValues("archive", "corrupted").Inc() |