Sfoglia il codice sorgente

Use the cache

This makes requests following the initial one *much* faster.
Lucas Stadler 8 anni fa
parent
commit
77c8ac593c
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      quit.go

+ 2 - 1
quit.go

39
		log.Fatal("opening repository: ", err)
39
		log.Fatal("opening repository: ", err)
40
	}
40
	}
41
41
42
	fancyRepo := NewFancyRepo(repo)
42
	http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
43
	http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
43
		performance.MeasureRequest(req)
44
		performance.MeasureRequest(req)
44
45
46
		start := time.Now()
47
		start := time.Now()
47
		err = repoTmpl.Execute(buf, map[string]interface{}{
48
		err = repoTmpl.Execute(buf, map[string]interface{}{
48
			"RepoPath":    path.Base(repoPath),
49
			"RepoPath":    path.Base(repoPath),
49
			"Repo":        NewFancyRepo(repo),
50
			"Repo":        fancyRepo,
50
			"Style":       template.CSS(repoStyle),
51
			"Style":       template.CSS(repoStyle),
51
			"Performance": performance.Render(req),
52
			"Performance": performance.Render(req),
52
		})
53
		})