fix host-maintaining code
This commit is contained in:
parent
6398e2a01f
commit
6a862f6f58
6
main.go
6
main.go
|
@ -112,7 +112,6 @@ func main() {
|
||||||
_, ltm, _ := lastTime.Clock()
|
_, ltm, _ := lastTime.Clock()
|
||||||
|
|
||||||
if llm != ltm {
|
if llm != ltm {
|
||||||
|
|
||||||
processBuckets(lastTime, ab)
|
processBuckets(lastTime, ab)
|
||||||
ab = map[string]*Bucket{}
|
ab = map[string]*Bucket{}
|
||||||
|
|
||||||
|
@ -152,7 +151,6 @@ func contains(host string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func processBuckets(lt time.Time, set map[string]*Bucket) {
|
func processBuckets(lt time.Time, set map[string]*Bucket) {
|
||||||
log.Printf("printing buckets for %s", lt.Format(outDateFormatNoSeconds))
|
|
||||||
for host, _ := range set {
|
for host, _ := range set {
|
||||||
if !contains(host) {
|
if !contains(host) {
|
||||||
seenHosts = append(seenHosts, host)
|
seenHosts = append(seenHosts, host)
|
||||||
|
@ -161,12 +159,14 @@ func processBuckets(lt time.Time, set map[string]*Bucket) {
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(seenHosts))
|
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 {
|
for _, host := range seenHosts {
|
||||||
bucket, ok := set[host]
|
bucket, ok := set[host]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
fmt.Printf("%s,%s,0,0,0,0\n", lt.Format(outDateFormat), host)
|
fmt.Printf("%s,%s,0,0,0,0\n", lt.Format(outDateFormat), host)
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var longest time.Duration
|
var longest time.Duration
|
||||||
|
|
Loading…
Reference in New Issue