mirror of
https://github.com/jech/galene.git
synced 2024-11-23 00:55: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:
parent
0261558e07
commit
91c161e548
1 changed files with 0 additions and 5 deletions
|
@ -305,10 +305,7 @@ func Add(name string, desc *description) (*Group, error) {
|
||||||
|
|
||||||
if desc != nil {
|
if desc != nil {
|
||||||
g.description = desc
|
g.description = desc
|
||||||
} else if time.Since(g.description.loadTime) < 5*time.Second {
|
|
||||||
return g, nil
|
|
||||||
} else if !descriptionChanged(name, g.description) {
|
} else if !descriptionChanged(name, g.description) {
|
||||||
g.description.loadTime = time.Now()
|
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,7 +699,6 @@ func matchClient(group string, c Challengeable, users []ClientCredentials) (bool
|
||||||
|
|
||||||
type description struct {
|
type description struct {
|
||||||
fileName string `json:"-"`
|
fileName string `json:"-"`
|
||||||
loadTime time.Time `json:"-"`
|
|
||||||
modTime time.Time `json:"-"`
|
modTime time.Time `json:"-"`
|
||||||
fileSize int64 `json:"-"`
|
fileSize int64 `json:"-"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
|
@ -811,7 +807,6 @@ func GetDescription(name string) (*description, error) {
|
||||||
desc.fileName = fileName
|
desc.fileName = fileName
|
||||||
desc.fileSize = fi.Size()
|
desc.fileSize = fi.Size()
|
||||||
desc.modTime = fi.ModTime()
|
desc.modTime = fi.ModTime()
|
||||||
desc.loadTime = time.Now()
|
|
||||||
|
|
||||||
return &desc, nil
|
return &desc, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue