website: more debug logging

Change-Id: Idd7b42a0f518878f8b941dc79f8d94663ed4c697
This commit is contained in:
Brad Fitzpatrick 2013-08-23 00:03:07 -05:00
parent d93cb4098f
commit 0c6c9d597f
1 changed files with 7 additions and 0 deletions

View File

@ -158,6 +158,7 @@ func commitEmailLoop() error {
select {
case <-time.After(1 * time.Minute):
case <-fetchc:
log.Printf("Polling git due to explicit trigger.")
}
}
}
@ -170,6 +171,9 @@ func pollCommits(dir string) {
log.Printf("Error running git fetch origin master in %s: %v\n%s", dir, err, out)
return
}
log.Printf("Ran git fetch.")
// TODO: see if .git/refs/remotes/origin/master changed. quicker.
hashes, err := recentCommits(dir)
if err != nil {
log.Print(err)
@ -205,12 +209,15 @@ func recentCommits(dir string) (hashes []string, err error) {
func mailNowHandler(w http.ResponseWriter, r *http.Request) {
select {
case <-tokenc:
log.Printf("/mailnow got a token")
default:
// Too many requests. Ignore.
log.Printf("Ignoring /mailnow request; too soon.")
return
}
select {
case fetchc <- true:
log.Printf("/mailnow triggered a git fetch")
default:
}
}