[中] 设置变化触发的后台重建线程无法取消,可能并行多个

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
65/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start at windows/birdlock/app/state.py:760-792, reading _rebuild_now() and the _job_gen counter, then find the existing LatestOnly helper the report says already lives in the project and see how it is used elsewhere. Trace how RenderJob is constructed inside the spawned work() so you know where a stale generation can return early. Done means dragging the slider on a long sequence keeps at most one rebuild thread alive and abandoned generations exit before doing the render work; the report was derived from an audit, not reproduced on Windows, so verify thread count by hand.

Written by the indexing model from the issue text.

Description

位置:windows/birdlock/app/state.py:760-792

现象:_rebuild_now() 每次 _job_gen += 1 后新开 threading.Thread,旧线程仍会完整构造 RenderJob,只是 done() 因 gen 不匹配丢弃结果。拖动滑块时若单次构建超过 60 ms,会累积多个线程与大量 CPU/IO。

复现:在长序列上快速拖动滑块,观察线程数与 CPU。

建议:改成单线程「只保留最新任务」的 worker(项目里已有 LatestOnly 实现),或在 work() 开头检查 gen 已过期即返回。

来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在 Windows 实机复现,复现路径由代码审计推得。

Dominant language
Swift
Stars
2
Forks
2
Avg merge
1h 11m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cyandee/BirdLock

All issues in cyandee/BirdLock

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.