Skip to content

nit: TSA cleanup - #9516

Merged
taylorsilva merged 4 commits into
masterfrom
tsa-cleanup
Apr 9, 2026
Merged

taylorsilva merged 4 commits into
masterfrom
tsa-cleanup

Conversation

@taylorsilva

Copy link
Copy Markdown
Member

Changes proposed by this PR

I pointed Claude at the TSA package, asking it to find any memory leaks or performance issues. I went through its analysis and resolved the legitimate issues.

  1. The sessionTeams map is never cleaned up and grows forever
  2. The var interrupted was in a data race

Claude kept stating there were issues with time.NewTicker() and time.After() calls in a few other places, but I ignored those after reading: https://pkg.go.dev/time#NewTicker

Before Go 1.23, the garbage collector did not recover tickers that had not yet expired or been stopped, so code often immediately deferred t.Stop after calling NewTicker, to make the ticker recoverable when it was no longer needed. As of Go 1.23, the garbage collector can recover unreferenced tickers, even if they haven't been stopped. The Stop method is no longer necessary to help the garbage collector. (Code may of course still want to call Stop to stop the ticker for other reasons.)

not needed since go1.23 (see time.NewTicker docs), but doesn't hurt
doing it and ensures we don't keep it around.

Signed-off-by: Taylor Silva <[email protected]>
the map would grow indefinitely as workers connect, disconnect, and
reconnect. This is part of the normal worker lifecycle, so this could
grow quite a bit over time.

Signed-off-by: Taylor Silva <[email protected]>
@taylorsilva
taylorsilva requested a review from a team April 9, 2026 16:10
@taylorsilva taylorsilva changed the title Tsa cleanup TSA cleanup Apr 9, 2026
@taylorsilva taylorsilva changed the title TSA cleanup nit: TSA cleanup Apr 9, 2026
@taylorsilva
taylorsilva merged commit 604aa49 into master Apr 9, 2026
12 checks passed
@taylorsilva
taylorsilva deleted the tsa-cleanup branch April 9, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant