56
[]nexusoperationpb.OperationStatus{nexusoperationpb.OPERATION_STATUS_SCHEDULED},
57
nexusoperationpb.OPERATION_STATUS_BACKING_OFF,
59
>
currentTime := ctx.Now(o)
60
>
61
>
// Record the attempt
62
>
o.LastAttemptCompleteTime = timestamppb.New(currentTime)
63
>
o.LastAttemptFailure = event.Failure
64
>
65
>
// Compute next retry delay
66
>
// Use 0 for elapsed time as we don't limit the retry by time (for now)
67
>
// The last argument (error) is ignored
68
>
nextDelay := event.RetryPolicy.ComputeNextDelay(0, int(o.Attempt), nil)
69
>
nextAttemptScheduleTime := currentTime.Add(nextDelay)
70
>
o.NextAttemptScheduleTime = timestamppb.New(nextAttemptScheduleTime)
71
>
72
>
// Emit a backoff task to retry after the delay
73
>
ctx.AddTask(o, chasm.TaskAttributes{
74
>
ScheduledTime: nextAttemptScheduleTime,
75
>
}, &nexusoperationpb.InvocationBackoffTask{
76
>
Attempt: o.Attempt,
77
>
})
78
>
79
>
return nil
80
>
},
81
)
82