fix host-maintaining code

This commit is contained in:
Cadey Ratio 2017-01-25 12:44:01 -08:00
parent 6398e2a01f
commit 6a862f6f58
1 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,6 @@ func main() {
_, ltm, _ := lastTime.Clock()
if llm != ltm {
processBuckets(lastTime, ab)
ab = map[string]*Bucket{}
@ -152,7 +151,6 @@ func contains(host string) bool {
}
func processBuckets(lt time.Time, set map[string]*Bucket) {
log.Printf("printing buckets for %s", lt.Format(outDateFormatNoSeconds))
for host, _ := range set {
if !contains(host) {
seenHosts = append(seenHosts, host)
@ -161,12 +159,14 @@ func processBuckets(lt time.Time, set map[string]*Bucket) {
sort.Sort(sort.StringSlice(seenHosts))
log.Printf("%s printing %d buckets for %d hosts", lt.Format(outDateFormatNoSeconds), len(set), len(seenHosts))
for _, host := range seenHosts {
bucket, ok := set[host]
if !ok {
fmt.Printf("%s,%s,0,0,0,0\n", lt.Format(outDateFormat), host)
return
continue
}
var longest time.Duration