fix(translator): let a manual run lift the debounce it is waiting on - #140
Open
SearheiParkhamchuk wants to merge 1 commit into
Open
fix(translator): let a manual run lift the debounce it is waiting on#140SearheiParkhamchuk wants to merge 1 commit into
SearheiParkhamchuk wants to merge 1 commit into
Conversation
"Run now" did nothing for a job queued with an auto-translate debounce. The picker skips a job whose `waitUntil` has not elapsed, and the blockers were only cleared for a job that was processing or had failed — a queued one is neither. So the button cleared nothing, the picker took nothing, and the caller was told the job was already in progress, which it was not. A manual run means now, so it now clears the debounce along with the lock and the spent retry budget. The remaining reasons the picker can decline are ones where "already running" is true: another job for the same document holds the concurrency key. `PayloadJob` gained the `waitUntil` field it always had in the row — part of why this was invisible. Closes #127
SearheiParkhamchuk
requested review from
ChiefCreator and
dogfrogfog
as code owners
September 13, 2026 11:35
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes #127.
What was wrong
The panel's Run now button did nothing for a job queued with an auto-translate debounce, and then said the job was already in progress.
run()hands the job to Payload's picker, which declines a job that isprocessing, carrieshasError, or has awaitUntilthat has not elapsed. Blockers were cleared only for a job that was processing or had failed — a queued one is neither, so itswaitUntilsurvived, the picker took nothing, and the single failure reason the runner has (already_running) went back to the editor.Two things were wrong with that. The button did not do what it is named. And the explanation was confidently false: the job was not running, it was waiting.
The fix
One line in
PayloadJobsTaskRunner.run(): clear the blockers unconditionally. A manual run means now, so it lifts the debounce along with the lock and the spent retry budget.After this, the case where the picker still declines is one where
already_runningis true — another job for the same document holds the concurrency key, when the host has enabled Payload's concurrency control.PayloadJobalso gained thewaitUntilfield. The row always had it; the type did not, which is part of why this was invisible from the runner.How it was verified
Test first. Against the unchanged code the new case fails with
Number of calls: 0— the blockers were never cleared. With the fix it passes, and putting the old condition back reddens it again.One existing test asserted
expect(mockPayload.update).not.toHaveBeenCalled()for a queued job — it pinned exactly the behaviour this change reverses. Rather than delete the assertion, it now checks that the clear happens before the picker is called, which is what makes lifting the debounce meaningful.mainas well.Scope note
#127 also asked for a distinct
RunResultmember so the admin could name the reason. That is not added here: after this change the one remaining decline genuinely is "already running", so a new member would have no case to describe. If a future decline reason appears that is neither, it should come with its own member then.