Skip to content

Commit

Permalink
Making isSeq always false
Browse files Browse the repository at this point in the history
  • Loading branch information
sethiay committed May 30, 2024
1 parent ae5930b commit 62eee6d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/cache/file/cache_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check failure on line 56 in internal/cache/file/cache_handle.go

View workflow job for this annotation

GitHub Actions / Lint

File is not `goimports`-ed (goimports)
return &CacheHandle{
fileHandle: localFileHandle,
fileDownloadJob: fileDownloadJob,
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 62eee6d

Please sign in to comment.