GH-2226: fix(executor): resolve stale threshold defaults treating 0 as unset#2229
Merged
alekspetrov merged 2 commits intomainfrom Apr 7, 2026
Merged
GH-2226: fix(executor): resolve stale threshold defaults treating 0 as unset#2229alekspetrov merged 2 commits intomainfrom
alekspetrov merged 2 commits intomainfrom
Conversation
…ecutor/`) - Add StaleRunningThreshold, StaleQueuedThreshold, StaleRecoveryInterval to DispatcherConfig (StaleTaskDuration kept as backwards-compat alias) - Rewrite recoverStaleTasks() to recover both running and queued orphans, marking them failed (not re-queued — re-queuing without a worker just recreates the orphan) - Change Start() to accept context.Context and launch runStaleRecoveryLoop goroutine that ticks every StaleRecoveryInterval - Add summary log "stale recovery complete, reset N tasks" on every pass (even when 0) for diagnosability - Update all Start() callers in main.go and tests - Add tests: TestRecoverStaleTasks_QueuedAndRunning, TestRecoverStaleTasks_RespectsThresholds, TestRunStaleRecoveryLoop_Periodic, TestQueueTask_AfterRecovery
The effective*Threshold() methods checked `> 0`, so explicitly setting thresholds to 0 (meaning "immediately stale") fell through to the 30m default. Replace the three methods with a single resolveDefaults() called once at construction — zero values are now honoured as-is, and only StaleRecoveryInterval gets a fallback (5m) since a 0-interval ticker panics. Fixes GH-2226
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
effective*Threshold()methods onDispatcherConfigchecked> 0, causing explicitly-set0thresholds (meaning "immediately stale") to fall through to the 30-minute defaulteffective*methods with a singleresolveDefaults()called once at construction inNewDispatcherStaleRecoveryIntervalgets a fallback (5m) since a 0-interval ticker would panicTest plan
go test -race ./internal/executor/...passes (all 4 previously-failing tests now pass)go build ./...cleango test ./...full suite passesFixes #2226
Depends on #2222