Add more error handling and mutex guards

This commit is contained in:
Pijus Kamandulis
2025-01-27 21:09:37 +02:00
parent d6b816b55a
commit 125f10d8a2
8 changed files with 62 additions and 26 deletions

View File

@@ -46,8 +46,8 @@ func (r *DataRepository) LoadStateFS(filePath string) {
}
func (r *DataRepository) LoadStateJSON(jsonData string) error {
r.storeState.RLock()
defer r.storeState.RUnlock()
r.storeState.Lock()
defer r.storeState.Unlock()
var state repositorymodels.State
if err := json.Unmarshal([]byte(jsonData), &state); err != nil {