From 91c161e5488b04018006fd1bbd10a3e44a4a95be Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 6 Feb 2021 21:44:14 +0100 Subject: [PATCH] Don't cache group files for 5s. A stat of a cached file is cheap, no need to micro-optimise. --- group/group.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/group/group.go b/group/group.go index 22f15a1..5e30547 100644 --- a/group/group.go +++ b/group/group.go @@ -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 }