forked from forgejo/forgejo
backport #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 .
(cherry picked from commit 9df573bddc
)
This commit is contained in:
parent
8f6d442a04
commit
745b45406d
7 changed files with 62 additions and 84 deletions
|
@ -104,7 +104,7 @@ func NewFuncMap() template.FuncMap {
|
|||
return setting.AssetVersion
|
||||
},
|
||||
"DisableGravatar": func(ctx context.Context) bool {
|
||||
return system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar)
|
||||
return system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar, setting.GetDefaultDisableGravatar())
|
||||
},
|
||||
"DefaultShowFullName": func() bool {
|
||||
return setting.UI.DefaultShowFullName
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue