Skip to content

Commit

Permalink
pkg/storage/azure: increase storage account key cache expiration
Browse files Browse the repository at this point in the history
make it 20 minutes instead of 5.

Azure has an api limit for storage account list (which apparently
listing keys uses behind the scenes) of 100 calls / 5 minutes. if a
project has a lot of clusters, this limit might be hit.
  • Loading branch information
flavianmissi authored and openshift-cherrypick-robot committed Oct 19, 2023
1 parent b0ee859 commit 78f556c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/storage/azure/cached_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
"github.com/openshift/cluster-image-registry-operator/pkg/metrics"
)

// cacheExpiration is the cache expiration duration in minutes.
const cacheExpiration time.Duration = 20 * time.Minute

// primaryKey keeps account primary key in a cache.
var primaryKey cachedKey

Expand Down Expand Up @@ -44,6 +47,6 @@ func (k *cachedKey) get(
k.resourceGroup = resourceGroup
k.account = account
k.value = *(*keysResponse.Keys)[0].Value
k.expire = time.Now().Add(5 * time.Minute)
k.expire = time.Now().Add(cacheExpiration)
return k.value, nil
}

0 comments on commit 78f556c

Please sign in to comment.