Skip to content

Commit

Permalink
Obtain status file lock when updating full status
Browse files Browse the repository at this point in the history
Co-authored-by: Seth Foster <fosterseth@users.noreply.github.com>
  • Loading branch information
shanemcd and fosterseth committed May 12, 2021
1 parent e8a789e commit 3f7156f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/workceptor/workunitbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3f7156f

Please sign in to comment.