fix: prevent concurrent jobs map writes by adding synchronization
This fix prevents undefined behavior and runtime crashes in multithreaded use cases.
This commit is contained in:
@@ -42,7 +42,7 @@ func (crd *Crd) Patch(jobUid types.UID, patchData map[string]interface{}) error
|
||||
if err != nil {
|
||||
pkg.Logger.Error("[crd] [status] error in structure unstructured patched", zap.Error(err))
|
||||
}
|
||||
jobs[jobUid] = newJob
|
||||
jobs.Store(jobUid, newJob)
|
||||
if err != nil {
|
||||
pkg.Logger.Error("[crd] [status] ", zap.Error(err))
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user