Apply linter autofixes: internal/vaultik (refs #61)
This commit is contained in:
@@ -42,6 +42,7 @@ func newRestoreSweeper(ctx context.Context, repos *database.Repositories, cache
|
||||
if threshold <= 0 {
|
||||
threshold = 1
|
||||
}
|
||||
|
||||
return &restoreSweeper{
|
||||
ctx: ctx,
|
||||
repos: repos,
|
||||
@@ -65,6 +66,7 @@ func (s *restoreSweeper) chunkRestored(n int64) {
|
||||
if s.bytesAccum < s.threshold {
|
||||
return
|
||||
}
|
||||
|
||||
s.bytesAccum = 0
|
||||
s.sweep()
|
||||
}
|
||||
@@ -77,8 +79,10 @@ func (s *restoreSweeper) sweep() {
|
||||
needed, err := s.blobStillNeeded(blobHash)
|
||||
if err != nil {
|
||||
log.Debug("sweeper referencing-files query failed", "blob_hash", blobHash[:16], "error", err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if !needed {
|
||||
s.cache.Delete(blobHash)
|
||||
}
|
||||
@@ -104,15 +108,20 @@ func (s *restoreSweeper) blobStillNeeded(blobHash string) (bool, error) {
|
||||
|
||||
for rows.Next() {
|
||||
var fileID string
|
||||
if err := rows.Scan(&fileID); err != nil {
|
||||
|
||||
err := rows.Scan(&fileID)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("scanning file_id: %w", err)
|
||||
}
|
||||
|
||||
if _, ok := s.restored[fileID]; !ok {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user