1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Don't cache group files for 5s.

A stat of a cached file is cheap, no need to micro-optimise.
This commit is contained in:
Juliusz Chroboczek 2021-02-06 21:44:14 +01:00
parent 0261558e07
commit 91c161e548

View file

@ -305,10 +305,7 @@ func Add(name string, desc *description) (*Group, error) {
if desc != nil {
g.description = desc
} else if time.Since(g.description.loadTime) < 5*time.Second {
return g, nil
} else if !descriptionChanged(name, g.description) {
g.description.loadTime = time.Now()
return g, nil
}
@ -702,7 +699,6 @@ func matchClient(group string, c Challengeable, users []ClientCredentials) (bool
type description struct {
fileName string `json:"-"`
loadTime time.Time `json:"-"`
modTime time.Time `json:"-"`
fileSize int64 `json:"-"`
Description string `json:"description,omitempty"`
@ -811,7 +807,6 @@ func GetDescription(name string) (*description, error) {
desc.fileName = fileName
desc.fileSize = fi.Size()
desc.modTime = fi.ModTime()
desc.loadTime = time.Now()
return &desc, nil
}