feat: add durable safe retries with uncertainty tracking and SDK examples
This commit is contained in:
@@ -332,6 +332,9 @@ func (w *WorkerConnection) Renew(ctx context.Context, id string, ref WorkerAttem
|
||||
// Finish 保存业务结果/证据;迟到结果可返回 EVIDENCE_ONLY,不能视为任务成功终结。
|
||||
func (w *WorkerConnection) Finish(ctx context.Context, id string, in WorkerFinish) (WorkerCommandResult, error) {
|
||||
var out WorkerCommandResult
|
||||
if in.Retryable && in.Outcome != WorkerFailed {
|
||||
return out, errors.New("retryable is only valid for known failure")
|
||||
}
|
||||
if (in.Outcome != WorkerSucceeded && in.Outcome != WorkerFailed && in.Outcome != WorkerUnknown) || len(in.Result) > 256<<10 || bytes.Equal(bytes.TrimSpace(in.Result), []byte("null")) || validateWorkerJSON(in.Result) != nil {
|
||||
return out, errors.New("invalid Worker result outcome or JSON")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user