Commit 91c161e5 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't cache group files for 5s.

A stat of a cached file is cheap, no need to micro-optimise.
parent 0261558e
...@@ -305,10 +305,7 @@ func Add(name string, desc *description) (*Group, error) { ...@@ -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 ...@@ -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) { ...@@ -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
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment