minor fixes

code review feedback
This commit is contained in:
John 2015-07-08 01:53:04 -04:00 committed by bemasher
parent b9240f925b
commit dbdbcae476
2 changed files with 2 additions and 2 deletions

View file

@ -46,7 +46,7 @@ var decimation = flag.Int("decimation", 1, "integer decimation factor, keep ever
var timeLimit = flag.Duration("duration", 0, "time to run for, 0 for infinite, ex. 1h5m10s")
var meterID UintMap
var meterType UintMap
var unique = flag.Bool("unique", false, "do not print duplicate values from each meter")
var unique = flag.Bool("unique", false, "do not print duplicate messages from each meter")
var encoder Encoder
var format = flag.String("format", "plain", "format to write log messages in: plain, csv, json, xml or gob")

View file

@ -157,7 +157,7 @@ func (rcvr *Receiver) Run() {
continue
}
if *unique {
if lastValue[uint(pkt.MeterID())] == pkt.MeterValue() {
if val, ok := lastValue[uint(pkt.MeterID())]; ok && val == pkt.MeterValue() {
continue
}
lastValue[uint(pkt.MeterID())] = pkt.MeterValue()