mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
Addresses P1 and P2 from code review on the RWMutex commit: P1 — Stream handlers now snapshot config under RLock before streaming: - handleDiffStream: clone Targets map to prevent concurrent map panic - handleCheckStream, handleAuditStream: snapshot source/projectRoot - handleUpdateStream: snapshot source (per-item Lock already correct) P2 — All read handlers now use narrow snapshot instead of defer RUnlock: - RLock → copy needed fields to locals → RUnlock → do work with locals - Prevents slow I/O (git fetch, version check, audit scan) from blocking the auto-reload middleware's exclusive Lock on concurrent requests Other changes: - computeTargetDiff takes source parameter (no more s.cfg.Source access) - Add cloneTargets() helper for safe map copying - Add writeOpsLogTo/writeAuditLogTo for lock-free oplog writes