diff options
Diffstat (limited to 'internal/vfs/zip/archive.go')
-rw-r--r-- | internal/vfs/zip/archive.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go index 47295dc0..df175764 100644 --- a/internal/vfs/zip/archive.go +++ b/internal/vfs/zip/archive.go @@ -68,11 +68,8 @@ func newArchive(fs *zipVFS, path string, openTimeout time.Duration) *zipArchive func (a *zipArchive) openArchive(parentCtx context.Context) (err error) { // return early if openArchive was done already in a concurrent request - select { - case <-a.done: - return a.err - - default: + if ok, err := a.openStatus(); ok { + return err } ctx, cancel := context.WithTimeout(parentCtx, a.openTimeout) @@ -283,3 +280,13 @@ func (a *zipArchive) Readlink(ctx context.Context, name string) (string, error) func (a *zipArchive) onEvicted() { metrics.ZipArchiveEntriesCached.Sub(float64(len(a.files))) } + +func (a *zipArchive) openStatus() (bool, error) { + select { + case <-a.done: + return true, a.err + + default: + return false, nil + } +} |