Skip to content

Commit 4f9b23a

Browse files
Callum Styanclaude
andcommitted
fix: close render cache even when reconciler never ran
The reconciler's Stop() method was returning early if the reconciler was never started (running == false), which meant the render cache cleanup goroutine was never stopped. This happened in tests that create reconcilers but never call Run() on them. When Stop() was called in t.Cleanup(), it would skip closing the render cache, causing goroutine leaks. Fix: Move renderCache.Close() to execute before the running check, so the cleanup goroutine is always stopped regardless of whether the reconciler was ever started. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 85bbae6 commit 4f9b23a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

enterprise/coderd/prebuilds/reconcile.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ func (c *StoreReconciler) Stop(ctx context.Context, cause error) {
268268
}
269269
}
270270

271+
// Close the render cache to stop its cleanup goroutine
272+
// This must be done regardless of whether the reconciler is running
273+
c.renderCache.Close()
274+
271275
// If the reconciler is not running, there's nothing else to do.
272276
if !c.running.Load() {
273277
return
@@ -292,9 +296,6 @@ func (c *StoreReconciler) Stop(ctx context.Context, cause error) {
292296
case <-c.done:
293297
c.logger.Info(context.Background(), "reconciler stopped")
294298
}
295-
296-
// Close the render cache to stop its cleanup goroutine
297-
c.renderCache.Close()
298299
}
299300

300301
// ReconcileAll will attempt to resolve the desired vs actual state of all templates which have presets with prebuilds configured.

0 commit comments

Comments
 (0)