feat: Optimize saveProfiles method by removing unnecessary read lock

This commit is contained in:
Snider 2025-12-11 14:08:02 +00:00
parent 0d412e6faa
commit a3ff0bbdaf

View file

@ -66,10 +66,8 @@ func (pm *ProfileManager) loadProfiles() error {
}
// saveProfiles writes the current profiles from memory to the JSON file.
// This is an internal method and assumes the caller holds the appropriate lock.
func (pm *ProfileManager) saveProfiles() error {
pm.mu.RLock()
defer pm.mu.RUnlock()
profileList := make([]*MiningProfile, 0, len(pm.profiles))
for _, p := range pm.profiles {
profileList = append(profileList, p)