Skip to content

Commit

Permalink
fix: harmony: Try other tasks when storage claim fails
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Apr 5, 2024
1 parent 385fb7a commit 485050e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/harmony/harmonytask/task_type_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ top:
}

// 3. What does the impl say?
canAcceptAgain:
tID, err := h.CanAccept(ids, h.TaskEngine)
if err != nil {
log.Error(err)
Expand All @@ -100,6 +101,18 @@ top:
if h.TaskTypeDetails.Cost.Storage != nil {
if err = h.TaskTypeDetails.Cost.Storage.Claim(int(*tID)); err != nil {
log.Infow("did not accept task", "task_id", strconv.Itoa(int(*tID)), "reason", "storage claim failed", "name", h.Name, "error", err)

if len(ids) > 1 {
var tryAgain = make([]TaskID, 0, len(ids)-1)
for _, id := range ids {
if id != *tID {
tryAgain = append(tryAgain, id)
}
}
ids = tryAgain
goto canAcceptAgain
}

return false
}
releaseStorage = func() {
Expand Down

0 comments on commit 485050e

Please sign in to comment.