feat(queue): a PC can run one game at a time, yours counted (LONGSHOT_QUEUE_ONE_GAME) #2792

Merged
HumanBean merged 1 commit from dyst/Longshot:fix/queue-game-waits-for-player into main 2026-11-29 06:13:01 +00:00
Member

Summary

The job queue starts up to 3 games at once (shared), and only timed runs wait for a game someone is playing: a shared or gpu run starts beside it. A PC that can run one game at a time had no setting for that (LONGSHOT_QUEUE_GPU_SHARED=1 still starts a run beside yours).

"LONGSHOT_QUEUE_ONE_GAME": "1" in the development folder's config/job_queue.json:

  • one shared slot, so one job with the game at a time;
  • every run with the game (shared, gpu, timing, profile) waits while a game runs that no running job started: the one you play, one started outside the queue, or one an ended job left. It keeps its place and holds nobody up meanwhile;
  • it is looked at again as the run is about to start, so a game opened while it waited counts too.

Builds go on beside the game, as now. Off by default: nothing changes for a PC that doesn't set it.

Read first: foreign_game and alone in scripts/devtools/jobqueue.py.

Testing

Tested: Windows 11, RTX 3080, no game started: a program named longshot.exe (a copy of ping) open, and a trivial --mode shared job queued beside it with the setting on. queue status gave "a game runs (keeps its place)"; the job started when the program closed, after 14 s.

tests/test_job_queue.py, OneGame (5 tests): four of them fail on main's queue and pass here; the fifth holds builds and the setting off as they were. The file's other two failures on this PC, inside the queue on Windows (test_a_pid_used_again_or_another_namespace_is_not_it, test_a_build_outside_the_queue), fail on main too (#2610).

Still to test:

  • Linux: the same check with a game started outside the queue, expecting the run to wait (by hand)

Measurements

Nothing to measure: the queue only, no game or build code. Off, run() does one more comparison a job; on, a process list every 10 s while a game run waits.

Risks

With the setting on, a game left open holds every queued game run until it is closed; queue status says so. A game whose environment can't be read (a sandboxed game's inner process) counts for neither side: its outer process does. Another version of the queue on the same PC ignores the setting. Turning it off in job_queue.json or a revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). Not run whole yet: the queue's own test above.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary The job queue starts up to 3 games at once (`shared`), and only timed runs wait for a game someone is playing: a `shared` or `gpu` run starts beside it. A PC that can run one game at a time had no setting for that (`LONGSHOT_QUEUE_GPU_SHARED=1` still starts a run beside yours). `"LONGSHOT_QUEUE_ONE_GAME": "1"` in the development folder's `config/job_queue.json`: - one shared slot, so one job with the game at a time; - every run with the game (`shared`, `gpu`, `timing`, `profile`) waits while a game runs that no running job started: the one you play, one started outside the queue, or one an ended job left. It keeps its place and holds nobody up meanwhile; - it is looked at again as the run is about to start, so a game opened while it waited counts too. Builds go on beside the game, as now. Off by default: nothing changes for a PC that doesn't set it. Read first: `foreign_game` and `alone` in `scripts/devtools/jobqueue.py`. ## Testing **Tested:** Windows 11, RTX 3080, no game started: a program named `longshot.exe` (a copy of `ping`) open, and a trivial `--mode shared` job queued beside it with the setting on. `queue status` gave "a game runs (keeps its place)"; the job started when the program closed, after 14 s. `tests/test_job_queue.py`, `OneGame` (5 tests): four of them fail on `main`'s queue and pass here; the fifth holds builds and the setting off as they were. The file's other two failures on this PC, inside the queue on Windows (`test_a_pid_used_again_or_another_namespace_is_not_it`, `test_a_build_outside_the_queue`), fail on `main` too (#2610). **Still to test:** - Linux: the same check with a game started outside the queue, expecting the run to wait (by hand) ## Measurements Nothing to measure: the queue only, no game or build code. Off, `run()` does one more comparison a job; on, a process list every 10 s while a game run waits. ## Risks With the setting on, a game left open holds every queued game run until it is closed; `queue status` says so. A game whose environment can't be read (a sandboxed game's inner process) counts for neither side: its outer process does. Another version of the queue on the same PC ignores the setting. Turning it off in `job_queue.json` or a revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). Not run whole yet: the queue's own test above. - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(queue): a PC can run one game at a time, yours counted (LONGSHOT_QUEUE_ONE_GAME)
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been skipped
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been skipped
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 14s
PR description / Title and description (pull_request_target) Failing after 11s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m8s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m58s
CI / Website build and checks (pull_request) Successful in 1m38s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 19m37s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 40m58s
2bc99b3460
The queue ran up to 3 games at once, and only timed runs waited for a game someone plays: a shared or gpu run started
beside it. With LONGSHOT_QUEUE_ONE_GAME=1 in job_queue.json there is one shared slot, and every run with the game waits
while a game runs that no running job started: a player's, or one an ended job left. Off by default.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #1523 fix(queue): on Windows the job queue waits for a player and sees builds outside it, as on Linux — Merged queue player detection is the foundation this extends
  • PR #2751 WIP: fix(dev): the queue names no NVIDIA cache folder for a game the Windows sandbox confines — Open change also touches jobqueue.py and queue behavior
Possibly related, for context: - PR #1523 fix(queue): on Windows the job queue waits for a player and sees builds outside it, as on Linux — Merged queue player detection is the foundation this extends - PR #2751 WIP: fix(dev): the queue names no NVIDIA cache folder for a game the Windows sandbox confines — Open change also touches jobqueue.py and queue behavior
HumanBean changed title from WIP: feat(queue): a PC can run one game at a time, yours counted (LONGSHOT_QUEUE_ONE_GAME) to feat(queue): a PC can run one game at a time, yours counted (LONGSHOT_QUEUE_ONE_GAME) 2026-11-29 06:12:51 +00:00
HumanBean deleted branch fix/queue-game-waits-for-player 2026-11-29 06:13:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2792
No description provided.