Commit 2353e253 authored by Kevin Atkinson's avatar Kevin Atkinson

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: default avatarKevin Atkinson <k@kevina.org>
parent e63957b6
......@@ -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)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment