Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set user setting multiple times #22537

Closed
KN4CK3R opened this issue Jan 19, 2023 · 0 comments · Fixed by #22539
Closed

Can't set user setting multiple times #22537

KN4CK3R opened this issue Jan 19, 2023 · 0 comments · Fixed by #22539
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself type/bug

Comments

@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 19, 2023

Regression of #22295

// SetUserSetting updates a users' setting for a specific key
func SetUserSetting(userID int64, key, value string) error {
if err := validateUserSettingKey(key); err != nil {
return err
}
_, err := cache.GetString(genSettingCacheKey(userID, key), func() (string, error) {
return value, upsertUserSettingValue(userID, key, value)
})
return err
}

The following code does not work:

SetUserSetting(1, "key", "value") // sets the setting to "value" and adds it to the cache
SetUserSetting(1, "key", "updated value") // does nothing because the cache already has the value and the update is skipped

Setting a value should always invalidate/update the cache and the cache should not prevent the update.

@lunny

@KN4CK3R KN4CK3R added type/bug issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself labels Jan 19, 2023
KN4CK3R added a commit that referenced this issue Jan 21, 2023
Fix #22537

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant