better context

This commit is contained in:
alex.sharov 2023-03-24 15:50:00 +07:00
parent 71d01a8653
commit 7da125879b
2 changed files with 2 additions and 9 deletions

View File

@ -1093,8 +1093,6 @@ func (h *History) prune(ctx context.Context, txFrom, txTo, limit uint64, logEver
}
select {
case <-ctx.Done():
return nil
case <-logEvery.C:
log.Info("[snapshots] prune history", "name", h.filenameBase, "to_step", fmt.Sprintf("%.2f", float64(txTo)/float64(h.aggregationStep)), "prefix", fmt.Sprintf("%x", key[:8]))
default:
@ -1128,8 +1126,6 @@ func (h *History) prune(ctx context.Context, txFrom, txTo, limit uint64, logEver
}
select {
case <-ctx.Done():
return nil
case <-logEvery.C:
log.Info("[snapshots] prune history", "name", h.filenameBase, "to_step", fmt.Sprintf("%.2f", float64(txTo)/float64(h.aggregationStep)), "prefix", fmt.Sprintf("%x", key[:8]))
default:

View File

@ -1137,8 +1137,7 @@ func (ii *InvertedIndex) collate(ctx context.Context, txFrom, txTo uint64, roTx
log.Debug("[snapshots] collate history", "name", ii.filenameBase, "range", fmt.Sprintf("%.2f-%.2f", float64(txNum)/float64(ii.aggregationStep), float64(txTo)/float64(ii.aggregationStep)))
bitmap.RunOptimize()
case <-ctx.Done():
err := ctx.Err()
return nil, err
return nil, ctx.Err()
default:
}
}
@ -1334,7 +1333,7 @@ func (ii *InvertedIndex) prune(ctx context.Context, txFrom, txTo, limit uint64,
}
select {
case <-ctx.Done():
return nil
return ctx.Err()
default:
}
}
@ -1356,8 +1355,6 @@ func (ii *InvertedIndex) prune(ctx context.Context, txFrom, txTo, limit uint64,
}
select {
case <-ctx.Done():
return nil
case <-logEvery.C:
log.Info("[snapshots] prune history", "name", ii.filenameBase, "to_step", fmt.Sprintf("%.2f", float64(txTo)/float64(ii.aggregationStep)), "prefix", fmt.Sprintf("%x", key[:8]))
default: