Skip to content

Commit 09b5348

Browse files
committed
Avoid concurrent map read/write.
1 parent b8cf48e commit 09b5348

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/runtime/depot.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ func (d *depot) SetCacheSize(mb int) {
160160
// Artifact metadata comes from the depot's cache, and may not exist for installed artifacts that
161161
// predate the cache.
162162
func (d *depot) Exists(id strfmt.UUID) (bool, *artifactInfo) {
163+
d.mapMutex.Lock()
164+
defer d.mapMutex.Unlock()
165+
163166
if _, ok := d.artifacts[id]; ok {
164167
if artifact, exists := d.config.Cache[id]; exists {
165168
return true, artifact

0 commit comments

Comments
 (0)