feat(runtime): run durable workers continuously
CI / test (push) Failing after 15s
CI / test (pull_request) Failing after 15s

This commit is contained in:
m
2026-08-22 13:57:08 +03:00
parent 6f5f7e1ee3
commit b0afa2417f
9 changed files with 180 additions and 24 deletions
+4
View File
@@ -12,6 +12,7 @@ type WorkerCycleResult struct {
RecoveredClaims int64
DispatchID string
Completed bool
Idle bool
}
func ExecuteWorkerCycle(ctx context.Context, store ports.WorkerStore, workerID string, token work.AgentFencingToken, now time.Time, staleAfter, leaseTTL time.Duration) (WorkerCycleResult, error) {
@@ -23,6 +24,9 @@ func ExecuteWorkerCycle(ctx context.Context, store ports.WorkerStore, workerID s
if err != nil {
return WorkerCycleResult{RecoveredClaims: recovered}, err
}
if item.DispatchID == "" {
return WorkerCycleResult{RecoveredClaims: recovered, Idle: true}, nil
}
intent, err := store.LoadDispatchIntent(ctx, item.DispatchID)
if err != nil {
_ = store.CompleteDispatch(ctx, item.DispatchID, workerID, work.AgentDispatchFailed, now.UnixMilli())