Skip to content

Commit

Permalink
fix faulty unlock in cache getAllExecutions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucamrgs authored and MaartendeKruijf committed Aug 8, 2024
1 parent 262f2d1 commit 818cad4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/reporter/downstream_reporter/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ func (cacheReporter *Cache) getAllExecutions() ([]cache_report.ExecutionEntry, e

// Lock
cacheReporter.mutex.Lock()
defer cacheReporter.mutex.Unlock()
for _, executionEntryKey := range cacheReporter.fifoRegister {
// NOTE: cached executions are passed by reference, so they must not be modified
entry, ok := cacheReporter.Cache[executionEntryKey]
if !ok {
// Unlock
return []cache_report.ExecutionEntry{}, errors.New("internal error. cache fifo register and cache executions mismatch")
}
executions = append(executions, entry)
}
cacheReporter.mutex.Unlock()
// Unlocked

// Unlocked
return executions, nil
}

Expand Down

0 comments on commit 818cad4

Please sign in to comment.