Skip to content

Commit

Permalink
set ready on file open as well as download complete (#13901)
Browse files Browse the repository at this point in the history
fixes: #13897
  • Loading branch information
mh0lt authored and AskAlexSharov committed Mar 6, 2025
1 parent 991c4a6 commit 1b6edf4
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions turbo/snapshotsync/snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,11 @@ func (s *RoSnapshots) VisibleBlocksAvailable(t snaptype.Enum) uint64 {
}

func (s *RoSnapshots) DownloadComplete() {
if !s.SegmentsReady() {
return
}
wasReady := s.downloadReady.Swap(true)
if !wasReady {
s.ready.set()
if s.SegmentsReady() {
s.ready.set()
}
}
}

Expand Down Expand Up @@ -987,7 +986,12 @@ func (s *RoSnapshots) InitSegments(fileNames []string) error {
}

s.recalcVisibleFiles()
s.segmentsReady.Store(true)
wasReady := s.segmentsReady.Swap(true)
if !wasReady {
if s.downloadReady.Load() {
s.ready.set()
}
}

return nil
}
Expand Down Expand Up @@ -1152,7 +1156,12 @@ func (s *RoSnapshots) OpenFolder() error {
}

s.recalcVisibleFiles()
s.segmentsReady.Store(true)
wasReady := s.segmentsReady.Swap(true)
if !wasReady {
if s.downloadReady.Load() {
s.ready.set()
}
}
return nil
}

Expand Down

0 comments on commit 1b6edf4

Please sign in to comment.