diff options
author | Max Magorsch <arzano@gentoo.org> | 2020-06-23 18:42:32 +0200 |
---|---|---|
committer | Max Magorsch <arzano@gentoo.org> | 2020-06-23 18:42:32 +0200 |
commit | a09e73588de7d9a45b16abbf8809a5cb1f1c80c8 (patch) | |
tree | 9c3827a74fe2356600825b092adce39ff643b81f | |
parent | Speed up computation of /{{listname}}/ (diff) | |
download | archives-a09e73588de7d9a45b16abbf8809a5cb1f1c80c8.tar.gz archives-a09e73588de7d9a45b16abbf8809a5cb1f1c80c8.tar.bz2 archives-a09e73588de7d9a45b16abbf8809a5cb1f1c80c8.zip |
Increase the verbosity of cache updates
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r-- | pkg/app/cache/update.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pkg/app/cache/update.go b/pkg/app/cache/update.go index c7d8c5a..7918b78 100644 --- a/pkg/app/cache/update.go +++ b/pkg/app/cache/update.go @@ -6,7 +6,9 @@ import ( "archives/pkg/app/popular" "archives/pkg/cache" "archives/pkg/config" + "fmt" "net/http" + "time" ) func UpdateHandler(w http.ResponseWriter, r *http.Request) { @@ -19,11 +21,25 @@ func Init(){ } func Update(){ + fmt.Println("Updating caches...") + + startTime := time.Now() cache.Put("/", home.ComputeTemplateData()) + fmt.Println("> Updated '/' in " + time.Now().Sub(startTime).String()) + + startTime = time.Now() cache.Put("/lists", list.ComputeBrowseTemplateData()) + fmt.Println("> Updated '/lists' in " + time.Now().Sub(startTime).String()) + + startTime = time.Now() cache.Put("/popular", popular.ComputeThreadsTemplateData()) + fmt.Println("> Updated '/popular' in " + time.Now().Sub(startTime).String()) + + startTime = time.Now() for _, listName := range config.AllPublicMailingLists() { + tmpStartTime := time.Now() cache.Put("/"+listName+"/", list.ComputeShowTemplateData(listName)) - cache.Put("/"+listName+"/", list.ComputeShowTemplateData(listName)) + fmt.Println(">> Updated '/" + listName + "/' in " + time.Now().Sub(tmpStartTime).String()) } + fmt.Println("> Updated '/{{list}}/' in " + time.Now().Sub(startTime).String()) } |