diff --git a/internal/cache/file/cache_handle.go b/internal/cache/file/cache_handle.go index c23bf6e165..1700bd7f5f 100644 --- a/internal/cache/file/cache_handle.go +++ b/internal/cache/file/cache_handle.go @@ -53,7 +53,7 @@ type CacheHandle struct { } func NewCacheHandle(localFileHandle *os.File, fileDownloadJob *downloader.Job, - fileInfoCache *lru.Cache, cacheFileForRangeRead bool, initialOffset int64) *CacheHandle { + fileInfoCache *lru.Cache, cacheFileForRangeRead bool, initialOffset int64) *CacheHandle { return &CacheHandle{ fileHandle: localFileHandle, fileDownloadJob: fileDownloadJob, @@ -80,8 +80,8 @@ func (fch *CacheHandle) validateCacheHandle() error { // downloaded cache file. Otherwise, it returns an appropriate error message. func (fch *CacheHandle) shouldReadFromCache(jobStatus *downloader.JobStatus, requiredOffset int64) (err error) { if jobStatus.Err != nil || - jobStatus.Name == downloader.Invalid || - jobStatus.Name == downloader.Failed { + jobStatus.Name == downloader.Invalid || + jobStatus.Name == downloader.Failed { err := fmt.Errorf("%s: jobStatus: %s jobError: %w", util.InvalidFileDownloadJobErrMsg, jobStatus.Name, jobStatus.Err) return err } else if jobStatus.Offset < requiredOffset { @@ -253,8 +253,9 @@ func (fch *CacheHandle) IsSequential(currentOffset int64) bool { if currentOffset-fch.prevOffset > downloader.ReadChunkSize { return false } - - return true + // Deliberately making isSeq false always so that the foreground read serves + // are not blocked + return false } // Close closes the underlying fileHandle pointing to locally downloaded cache file.