Commit 0ecf5b7
committed
Fix race condition in database client initialization
Fixed a race condition in the checker's Client field initialization
by using sync.Once to ensure thread-safe, single initialization even
when fetchDatabaseUri is called concurrently.
Changes:
- Added sync.Once field (clientOnce) to checker struct
- Replaced check-then-act pattern with sync.Once.Do()
- Removed FIXME comment as issue is now resolved
This ensures that even if multiple goroutines call fetchDatabaseUri
simultaneously, the Client will only be initialized once without
any race conditions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent d663cde commit 0ecf5b7
1 file changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
| 390 | + | |
389 | 391 | | |
390 | 392 | | |
391 | 393 | | |
| |||
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
410 | 411 | | |
411 | 412 | | |
412 | 413 | | |
| |||
0 commit comments