Skip to content

Commit

Permalink
fix(store/cache): force close Accessor if not closed within timeout (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss authored Aug 20, 2024
1 parent d1ef925 commit 682c2b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion share/eds/cache/accessor_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ func (s *accessorWithBlockstore) close() error {
done := s.done
s.Unlock()

// wait until all references are released or timeout is reached. If timeout is reached, log an
// error and close the accessor forcefully.
select {
case <-done:
case <-time.After(defaultCloseTimeout):
return fmt.Errorf("closing accessor, some readers didn't close the accessor within timeout,"+
log.Errorf("closing accessor, some readers didn't close the accessor within timeout,"+
" amount left: %v", s.refs.Load())
}
if err := s.shardAccessor.Close(); err != nil {
Expand Down

0 comments on commit 682c2b4

Please sign in to comment.