Skip to content

Commit

Permalink
minor changes in avro
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Apr 4, 2017
1 parent c1aa9cc commit 8e70116
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benchmark/perf-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const v8 = require('v8-natives');
let ServiceBroker = require("../src/service-broker");
let Context = require("../src/context");
let Transporters = require("../src/transporters");
let Serializer = require("../src/serializers/avro");
let Serializer = require("../src/serializers/json");

let { generateToken, json2String } = require("../src/utils");
let Promise = require("bluebird");
Expand Down
6 changes: 4 additions & 2 deletions src/serializers/avro.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ class AvroSerializer extends BaseSerializer {
* @memberOf Serializer
*/
serialize(obj, type) {
const t = schemas[type].toBuffer(obj);
return t.toString("binary");
//const t = schemas[type].toBuffer(obj);
const t = schemas[type].toBuffer(obj).toString("binary");
return t;
}

/**
Expand All @@ -129,6 +130,7 @@ class AvroSerializer extends BaseSerializer {
* @memberOf Serializer
*/
deserialize(str, type) {
//const res = schemas[type].fromBuffer(str);
const res = schemas[type].fromBuffer(Buffer.from(str, "binary"));
return res;
}
Expand Down

0 comments on commit 8e70116

Please sign in to comment.