Skip to content

Commit

Permalink
Improve the search order for localTaskStore array (#3166)
Browse files Browse the repository at this point in the history
Signed-off-by: Qi <37133148+aobt@users.noreply.github.com>
  • Loading branch information
aobt authored Apr 8, 2024
1 parent 67bb7a6 commit 405ed00
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/daemon/storage/storage_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ func (s *storageManager) FindCompletedTask(taskID string) *ReusePeerTask {
if !ok {
return nil
}
for _, t := range ts {
for i := len(ts) - 1; i > -1; i-- {
t := ts[i]
if t.invalid.Load() {
continue
}
Expand Down Expand Up @@ -549,7 +550,8 @@ func (s *storageManager) FindPartialCompletedTask(taskID string, rg *nethttp.Ran
if !ok {
return nil
}
for _, t := range ts {
for i := len(ts) - 1; i > -1; i-- {
t := ts[i]
if t.invalid.Load() {
continue
}
Expand Down Expand Up @@ -583,7 +585,8 @@ func (s *storageManager) FindCompletedSubTask(taskID string) *ReusePeerTask {
if !ok {
return nil
}
for _, t := range ts {
for i := len(ts) - 1; i > -1; i-- {
t := ts[i]
if t.invalid.Load() {
continue
}
Expand Down

0 comments on commit 405ed00

Please sign in to comment.