remove the sleeps and busy loop more times when waiting for missing objects

This commit is contained in:
vyzo 2021-07-05 10:31:47 +03:00
parent 1726eb993c
commit 3597192d58

View File

@ -930,13 +930,12 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
count = 0
for len(missing) > 0 {
if try >= 5 {
if try >= 100 {
return xerrors.Errorf("missing %d objects after %d attempts; giving up", len(missing), try)
}
try++
// wait a bit
time.Sleep(time.Minute)
log.Infow("marking missing objects", "attempt", try, "missing", len(missing), "marked", count)
towalk := missing
@ -1406,7 +1405,7 @@ func (s *SplitStore) purge(curTs *types.TipSet, cids []cid.Cid) error {
again:
s.txnLk.Lock()
if len(s.txnMissing) > 0 {
if try >= 5 {
if try >= 100 {
count := len(s.txnMissing)
s.txnLk.Unlock()
return xerrors.Errorf("error purging: missing %d objects after %d attempts; giving up", count, try)
@ -1418,9 +1417,6 @@ func (s *SplitStore) purge(curTs *types.TipSet, cids []cid.Cid) error {
s.txnMissing = make(map[cid.Cid]struct{})
s.txnLk.Unlock()
if try > 1 {
time.Sleep(time.Minute)
}
err := protectMissing(missing)
if err != nil {
return xerrors.Errorf("purge error: error protecting missing objects: %w", err)