From 3f7156f3ac58dc10f3f6d1e8b58adf4b0dad74ae Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Wed, 12 May 2021 17:50:22 -0400 Subject: [PATCH] Obtain status file lock when updating full status Co-authored-by: Seth Foster --- pkg/workceptor/workunitbase.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/workceptor/workunitbase.go b/pkg/workceptor/workunitbase.go index cc570cb5d..0faa481f3 100644 --- a/pkg/workceptor/workunitbase.go +++ b/pkg/workceptor/workunitbase.go @@ -251,6 +251,8 @@ func (sfd *StatusFileData) UpdateFullStatus(filename string, statusFunc func(*St // UpdateFullStatus atomically updates the whole status record. Changes should be made in the callback function. // Errors are logged rather than returned. func (bwu *BaseWorkUnit) UpdateFullStatus(statusFunc func(*StatusFileData)) { + bwu.statusLock.Lock() + defer bwu.statusLock.Unlock() err := bwu.status.UpdateFullStatus(bwu.statusFileName, statusFunc) bwu.lastUpdateError = err if err != nil {