Skip to content

Resolve race condition#17

Open
skatkov wants to merge 5 commits into
fumeapp:mainfrom
skatkov:race-conditions
Open

Resolve race condition#17
skatkov wants to merge 5 commits into
fumeapp:mainfrom
skatkov:race-conditions

Conversation

@skatkov
Copy link
Copy Markdown

@skatkov skatkov commented May 12, 2026

fixing #16

Unfortunately, there are a couple of breaking changes. As an example, instead of setting .Title, now SetTitle has to be used.

It's probably ok, because this library is not stable version. But maybe it requires a CHANGELOG of some sorts?

I've been running this in my app, so far without any issues.

@skatkov skatkov force-pushed the race-conditions branch from ec71689 to 289aec6 Compare May 12, 2026 20:39
skatkov added 3 commits May 12, 2026 22:39
Guard the package-level Bubble Tea program with a mutex so task goroutines cannot race with Run while it publishes or clears the program pointer. Route program sends through a helper that snapshots the pointer under the same lock before sending.
Start task execution from the Bubble Tea model and route task lifecycle, title, progress, completion, and failure updates through messages handled by Model.Update. Tasks now mutate private snapshots and use SetTitle/SetHideView/Progress to publish safe updates, so rendering no longer reads runner/task fields concurrently with background writes.
@skatkov skatkov changed the title reproduce a race condition Resolve race condition May 15, 2026
- Simplified runRunners error flow.
- Deferred taskUpdateCallbacks.Delete(...) so callback cleanup is guaranteed.
- Moved ANSI escape regex compilation out of Write.
- Removed low-value comments.
- Straightened applyProgress’s zero-total path.
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.

1 participant