diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-09-11 18:14:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-11 10:14:01 +0000 |
commit | ebff0513dbe8abd2c9807789c006f41d002416b5 (patch) | |
tree | fd7364ec34133204243ca5314825ab1f4353e7ef /routers/web/user | |
parent | 598465eb43e2c85f9e50934cc9b6b742a99e7d46 (diff) | |
download | gitea-ebff0513dbe8abd2c9807789c006f41d002416b5.tar.gz gitea-ebff0513dbe8abd2c9807789c006f41d002416b5.zip |
Fix context cache bug & enable context cache for dashabord commits' authors (#26991)
Unfortunately, when a system setting hasn't been stored in the database,
it cannot be cached.
Meanwhile, this PR also uses context cache for push email avatar display
which should avoid to read user table via email address again and again.
According to my local test, this should reduce dashboard elapsed time
from 150ms -> 80ms .
Diffstat (limited to 'routers/web/user')
-rw-r--r-- | routers/web/user/setting/profile.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index e1dc5680ca..0321a5759b 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -44,7 +44,9 @@ func Profile(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings.profile") ctx.Data["PageIsSettingsProfile"] = true ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice() - ctx.Data["DisableGravatar"] = system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar) + ctx.Data["DisableGravatar"] = system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar, + setting.GetDefaultDisableGravatar(), + ) ctx.HTML(http.StatusOK, tplSettingsProfile) } @@ -86,7 +88,9 @@ func ProfilePost(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsProfile"] = true ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice() - ctx.Data["DisableGravatar"] = system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar) + ctx.Data["DisableGravatar"] = system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar, + setting.GetDefaultDisableGravatar(), + ) if ctx.HasError() { ctx.HTML(http.StatusOK, tplSettingsProfile) |