Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions common/concurrent/cached_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,10 @@ func (c *CachedValue[T]) run(r *run[T], produce func() (T, bool, error)) (value
}()

value, store, err = produce()
return value, err
return
}

// publish records the attempt, stores what is worth keeping, and ends the pass. Closing
// done before clearing running keeps a caller from starting a pass of its own while this
// one is still published as in flight.
// publish records the attempt, stores what is worth keeping, and ends the pass.
func (c *CachedValue[T]) publish(r *run[T], value T, store bool, err error) {
c.mu.Lock()
defer c.mu.Unlock()
Expand Down
4 changes: 1 addition & 3 deletions db/snapshotsync/freezeblocks/block_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,9 @@ func (r *RemoteBlockReader) FrozenBlocksObserved() (uint64, bool) {
if observed {
return value, true
}
timeout := time.NewTimer(r.frozenBlocksTimeout)
defer timeout.Stop()
select {
case <-refreshed:
case <-timeout.C:
case <-time.After(r.frozenBlocksTimeout):
}
value, observed, _ = r.frozenBlocks.Load()
return value, observed
Expand Down
Loading