aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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())
}