[#378] metabase: Calculate expiration once for each fake bucket

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-19 11:34:13 +03:00 committed by Alex Vanin
parent a6d5556dc1
commit bc5e04f502

View file

@ -58,14 +58,14 @@ func (db *DB) iterateExpired(tx *bbolt.Tx, epoch uint64, h ExpiredObjectHandler)
return nil
}
return bktExpired.ForEach(func(idKey, _ []byte) error {
expiresAt, err := strconv.ParseUint(string(expKey), 10, 64)
if err != nil {
return errors.Wrap(err, "could not parse expiration epoch")
} else if expiresAt >= epoch {
return nil
}
expiresAt, err := strconv.ParseUint(string(expKey), 10, 64)
if err != nil {
return errors.Wrap(err, "could not parse expiration epoch")
} else if expiresAt >= epoch {
return nil
}
return bktExpired.ForEach(func(idKey, _ []byte) error {
id := object.NewID()
err = id.Parse(string(idKey))