From 2353e253587ef3015c6d64a3edd303d46cd54ee5 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Thu, 21 Apr 2016 01:00:00 -0400 Subject: [PATCH] In the measure package don't return ErrInvalidType in batch Put. None of the other methods in the measure package return this error, instead they only call RecordValue() when the value is []byte. This change makes batch Put consistent with the other methods and allows non []byte data to be passed though the measure datastore. License: MIT Signed-off-by: Kevin Atkinson --- measure/measure.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/measure/measure.go b/measure/measure.go index 49e5012..1193659 100644 --- a/measure/measure.go +++ b/measure/measure.go @@ -179,10 +179,9 @@ func (m *measure) Batch() (datastore.Batch, error) { func (mt *measuredBatch) Put(key datastore.Key, val interface{}) error { mt.puts++ valb, ok := val.([]byte) - if !ok { - return datastore.ErrInvalidType + if ok { + _ = mt.m.putSize.RecordValue(int64(len(valb))) } - _ = mt.m.putSize.RecordValue(int64(len(valb))) return mt.putts.Put(key, val) }