Skip to content

Fix tick leak#1669

Merged
dgageot merged 1 commit intodocker:mainfrom
rumpl:fix-tick-leak
Feb 10, 2026
Merged

Fix tick leak#1669
dgageot merged 1 commit intodocker:mainfrom
rumpl:fix-tick-leak

Conversation

@rumpl
Copy link
Member

@rumpl rumpl commented Feb 9, 2026

The animation subscription was a value, that got copied so Stop()ing would stop a copied subscription resulting in ~10% CPU usage once the assistant finished answering and nothing was moving on the screen.

Make sure that all the spinners share the same animation subscription

@rumpl rumpl requested a review from a team as a code owner February 9, 2026 23:24
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: Fix tick leak

Summary

The core fix (changing animSub from value to pointer type) correctly addresses the tick leak issue. However, I found some concerns with the defensive nil-check code added in Init().

Findings

  • 1 Medium severity issue: The nil-check in Init() doesn't work as intended due to value receiver semantics
  • 1 Medium severity issue: The test doesn't validate the nil-check defensive code

Recommendation

The main bug fix is sound, but the defensive nil-checks have issues. Since New() always initializes animSub properly, consider either:

  1. Using a pointer receiver for Init() to make the nil-check work correctly
  2. Removing the nil-checks and documenting that zero-value Spinners are unsupported
  3. Keeping as-is if zero-value Spinners are never created in practice

Given that all usage appears to go through New(), the current code will work correctly in practice.

The animation subscription was a value, that got copied so Stop()ing
would stop a copied subscription resulting in ~10% CPU usage once the
assistant finished answering and nothing was moving on the screen.

Make sure that all the spinners share the same animation subscription

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@dgageot dgageot merged commit d52eaf6 into docker:main Feb 10, 2026
5 checks passed
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