Fixed fatal error 'concurrent map iteration and map write' that caused
nginx-ui nodes to crash and become unresponsive.
The issue occurred when the sitecheck CollectSites() method iterated over
site.IndexedSites while the cache scanner's scanForSite() was concurrently
modifying the same map. This race condition caused sporadic crashes.
Solution:
- Added GetAllIndexedSites() function in internal/site/index.go that safely
returns a snapshot copy of the IndexedSites map while holding the read lock
- Modified CollectSites() in internal/sitecheck/checker.go to use this
thread-safe function instead of directly accessing the global map
Fixes#1673
Co-authored-by: Cursor Agent <cursoragent@cursor.com>