Merge pull request #1459 from snyk/fix/bad_cache_unlocks

fix: Bad cache unlocks in IAM repo
main
Elie 2022-04-01 16:00:35 +02:00 committed by GitHub
commit 7e4d53ee3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@ func (r *iamRepository) ListAllUsers() ([]*iam.User, error) {
cacheKey := "iamListAllUsers"
v := r.cache.GetAndLock(cacheKey)
r.cache.Unlock(cacheKey)
defer r.cache.Unlock(cacheKey)
if v != nil {
return v.([]*iam.User), nil
}
@ -108,7 +108,7 @@ func (r *iamRepository) ListAllPolicies() ([]*iam.Policy, error) {
func (r *iamRepository) ListAllRoles() ([]*iam.Role, error) {
cacheKey := "iamListAllRoles"
v := r.cache.GetAndLock(cacheKey)
r.cache.Unlock(cacheKey)
defer r.cache.Unlock(cacheKey)
if v != nil {
return v.([]*iam.Role), nil
}