Skip to content

Fix area visualizer breaking after stop/start cycle#258

Closed
Copilot wants to merge 2 commits intorefactor/visualizerfrom
copilot/sub-pr-257
Closed

Fix area visualizer breaking after stop/start cycle#258
Copilot wants to merge 2 commits intorefactor/visualizerfrom
copilot/sub-pr-257

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

stopVisualizing() was cancelling all child jobs in scope, including the long-lived consumeEach worker that drains computationChannel. Since startVisualizing() is delegated and never recreates the worker, any settings/corner mutations after the first stop/start cycle silently enqueued to a dead channel.

Changes

  • Store worker referenceprivate val workerJob: Job holds the consumeEach coroutine launched in init
  • Preserve worker in stopVisualizing() — only cancels non-worker scope children:
    scope.coroutineContext[Job]?.children?.forEach { child ->
        if (child !== workerJob) child.cancel()
    }
  • Guard recompute() against stale execution — added !isVisualizing() early-returns after each suspension point to prevent an in-flight recompute from spawning entities after the visualizer has been stopped

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…sualizerAreaImpl

Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/a087fbec-b95d-49bd-aec5-8fb163cb2aff
Copy link
Contributor Author

Copilot AI commented Mar 20, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • piston-data.mojang.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx4G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] [WIP] Address feedback on visualizer state management and concurrency handling Fix area visualizer breaking after stop/start cycle Mar 20, 2026
Copilot AI requested a review from twisti-dev March 20, 2026 22:07
@twisti-dev twisti-dev closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants