Skip to content

Commit

Permalink
fix: lock tenant map to avoid race (#702)
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Buto <cbuto@d2iq.com>
  • Loading branch information
cbuto committed Jun 29, 2023
1 parent fcb3049 commit d459f51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/chartmuseum/server/multitenant/cache.go
Expand Up @@ -100,7 +100,9 @@ func (server *MultiTenantServer) primeCache() error {
// getChartList fetches from the server and accumulates concurrent requests to be fulfilled all at once.
func (server *MultiTenantServer) getChartList(log cm_logger.LoggingFn, repo string) <-chan fetchedObjects {
ch := make(chan fetchedObjects, 1)
server.TenantCacheKeyLock.Lock()
tenant := server.Tenants[repo]
server.TenantCacheKeyLock.Unlock()

tenant.FetchedObjectsLock.Lock()
tenant.FetchedObjectsChans = append(tenant.FetchedObjectsChans, ch)
Expand Down

0 comments on commit d459f51

Please sign in to comment.