mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
* Add test for #4803: Race condition in initialisationComplete flag Add TestInitialisationComplete_RaceCondition to demonstrate the data race that occurs when the initialisationComplete boolean flag is accessed concurrently by multiple goroutines without synchronization. The test simulates: - Init goroutine writing to the flag - Query executor reading via isInitialised() - Notification handler reading the flag directly This test will fail when run with the -race flag, exposing the bug. Co-Authored-By: Claude <noreply@anthropic.com> * Fix #4803: Use atomic.Bool for initialisationComplete flag Replace the plain boolean initialisationComplete field with atomic.Bool to prevent data races when accessed concurrently by multiple goroutines. Changes: - Change field type from bool to atomic.Bool - Use .Store(true) for writes - Use .Load() for reads in isInitialised() and handleConnectionUpdateNotification() - Update test to use atomic operations The test now passes with -race flag, confirming the race condition is fixed. --------- Co-authored-by: Claude <noreply@anthropic.com>