Conversation
… jobs. A watchdog on the translate loop kills the BabelDOC/worker tree when a running job exceeds 45m (fast) or 3h (slow), then requeues it at the end of the same lane or skips it after three strikes. Co-authored-by: Daniel <znsoft@163.com>
…not rewrite status during TempDir cleanup. Co-authored-by: Daniel <znsoft@163.com>
Co-authored-by: Daniel <znsoft@163.com>
znsoftm
marked this pull request as ready for review
September 15, 2026 22:57
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.
A stuck BabelDOC/Google job can occupy the only translate slot for hours (production:
2609.15818sat ~6h on HTTP 429 with 「166 排队 / 1 翻译中」). This adds a queue watchdog so a hang cannot block the dual-lane pool forever.Behavior
running, wall-clock is measured from persistedstarted_at.translate_worker/ BabelDOC process tree (pidfile + cmdline + descendants), free the in-memory slot immediately, increment persistenttimeout_count.timeout_count < max: requeue at the end of the same lane (so other work proceeds) with errortimeout (attempt N/3); requeued.timeout_count >= max(default 3): statusskipped, errortimed out 3 times; permanently skipped. Auto-translate and translate-all will not pick it up again.POST /papers/translatefor that id resetstimeout_countso an admin can retry.runOnejobs and OS workers adopted byreconcileExternal.Env knobs
PAPERS_TRANSLATE_FAST_TIMEOUT45m45m) or integer minutesPAPERS_TRANSLATE_SLOW_TIMEOUT3hPAPERS_TRANSLATE_MAX_TIMEOUTS3Google QPS and default concurrency are unchanged.
Tests
go test ./internal/api/covers duration/env parsing, requeue +timeout_count, permanent skip, and leaving in-window jobs alone.