Skip to content

Commit

Permalink
Fix cleanupDelayedSlices to respect time limits as expected (#5463)
Browse files Browse the repository at this point in the history
Signed-off-by: Changxin Miao <[email protected]>
  • Loading branch information
polyrabbit authored Dec 30, 2024
1 parent 635a37c commit 591e095
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/meta/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2914,11 +2914,11 @@ func (r *redisMeta) doCleanupDelayedSlices(edge int64) (int, error) {
r.deleteSlice(s.Id, s.Size)
count++
}
if time.Since(start) > 50*time.Minute {
return stop
}
}
}
if time.Since(start) > 50*time.Minute {
return stop
}
return nil
})
if err == stop {
Expand Down
5 changes: 4 additions & 1 deletion pkg/meta/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -2863,9 +2863,12 @@ func (m *dbMeta) doCleanupDelayedSlices(edge int64) (int, error) {
m.deleteSlice(s.Id, s.Size)
count++
}
if time.Since(start) > 50*time.Minute {
return count, nil
}
}
}
if len(result) < batch || time.Since(start) > 50*time.Minute {
if len(result) < batch {
break
}
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/meta/tkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -2338,9 +2338,12 @@ func (m *kvMeta) doCleanupDelayedSlices(edge int64) (int, error) {
m.deleteSlice(s.Id, s.Size)
count++
}
if time.Since(start) > 50*time.Minute {
return count, nil
}
}
}
if len(keys) < batch || time.Since(start) > 50*time.Minute {
if len(keys) < batch {
break
}
}
Expand Down

0 comments on commit 591e095

Please sign in to comment.