@@ 1230,7 1230,7 @@ func savetracks(tracks map[string][]stri
dlog.Printf("saved %d new fetches", count)
}
-var trackchan = make(chan Track)
+var trackchan = make(chan Track, 4)
var dumptracks = make(chan chan bool)
func tracker() {
@@ 1251,11 1251,13 @@ func tracker() {
case c := <-dumptracks:
if len(tracks) > 0 {
savetracks(tracks)
+ tracks = make(map[string][]string)
}
c <- true
case <-endoftheworld:
if len(tracks) > 0 {
savetracks(tracks)
+ tracks = make(map[string][]string)
}
readyalready <- true
return
@@ 1277,7 1279,10 @@ func requestActor(r *http.Request) strin
func trackback(xid string, r *http.Request) {
who := requestActor(r)
if who != "" {
- trackchan <- Track{xid: xid, who: who}
+ select {
+ case trackchan <- Track{xid: xid, who: who}:
+ default:
+ }
}
}