aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-23 18:42:32 +0200
committerMax Magorsch <arzano@gentoo.org>2020-06-23 18:42:32 +0200
commita09e73588de7d9a45b16abbf8809a5cb1f1c80c8 (patch)
tree9c3827a74fe2356600825b092adce39ff643b81f
parentSpeed up computation of /{{listname}}/ (diff)
downloadarchives-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.go18
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())
}