Skip to content

Commit 5599568

Browse files
authored
Merge pull request #35 from pfnet-research/fix-nil-dereference-in-slavaging-worker
nil check in salvaging task so to fix nil dereference in it
2 parents d0ecdb4 + ccc823f commit 5599568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/backend/redis/worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ func (b *Backend) SalvageWorker(ctx context.Context, queueUID, salvagingWorkerUI
360360
pipe.Del(b.workerPendingTaskQueueKey(queue.UID.String(), salvageTargetWorker.UID.String()))
361361
pipe.Set(b.workerKey(queue.UID.String(), salvageTargetWorker.UID.String()), marshaledSalvageTargetWorker, -1)
362362
for i, t := range tasksToSalvage {
363-
if len(t.Status.History) > 0 &&
363+
if len(t.Status.History) > 0 && t.Status.History[len(t.Status.History)-1].SalvagedBy != nil &&
364364
*t.Status.History[len(t.Status.History)-1].SalvagedBy == salvagingWorker.UID {
365365
workerUID := t.Status.History[len(t.Status.History)-1].WorkerUID
366366
pipe.SRem(b.workerTasksKey(queue.UID.String(), workerUID), t.UID)

0 commit comments

Comments
 (0)