Tracking times of saving pages
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-06-30 19:50:12 +02:00
parent 02be21244d
commit 32328a5a9b

11
file.go
View File

@ -8,6 +8,7 @@ import (
"html" "html"
"html/template" "html/template"
"io/ioutil" "io/ioutil"
"log"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@ -85,6 +86,13 @@ func (fp *FilePages) Save(p string, page Page, summary, author string) error {
} }
func (fp *FilePages) save(msg saveMessage) error { func (fp *FilePages) save(msg saveMessage) error {
startTime := time.Now()
defer func() {
endTime := time.Now()
d := endTime.Sub(startTime)
log.Printf("Page saved in %s\n", d.String())
}()
p := msg.p p := msg.p
page := msg.page page := msg.page
summary := msg.summary summary := msg.summary
@ -119,7 +127,7 @@ func (fp *FilePages) save(msg saveMessage) error {
if err != nil { if err != nil {
return err return err
} }
// err = saveDocuments(fp) err = saveDocuments(fp)
err = saveLinks(fp) err = saveLinks(fp)
return err return err
} }
@ -148,6 +156,7 @@ func saveLinks(fp *FilePages) error {
} }
return nil return nil
} }
func saveDocuments(fp *FilePages) error { func saveDocuments(fp *FilePages) error {
type Document struct { type Document struct {
Title string `json:"title"` Title string `json:"title"`