Skip to content

Commit 3543bd8

Browse files
committed
change benchmark to use PassThrough.push
1 parent ce72df3 commit 3543bd8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

benchmark/simple-query-parsing.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@ var Client = require(__dirname + '/../lib/client');
22
var buffers = require(__dirname + '/../test/test-buffers');
33
require(__dirname + '/../test/unit/test-helper');
44

5-
var stream = new MemoryStream();
5+
var stream = new require('stream').PassThrough();
66
stream.readyState = 'open';
7+
stream.write = function() {
8+
//the stream used in the connection is
9+
//already considered a duplex stream
10+
//and its write method is used for writing
11+
//out to postgres so for the benchmark
12+
//ignore all writing so outgoing buffers
13+
//do not get sent to the reader
14+
};
715
var client = new Client({
816
stream: stream
917
});
@@ -52,7 +60,7 @@ client.connect(assert.calls(function() {
5260
assert.equal(res.rows.length, 9);
5361
done();
5462
});
55-
buffers.forEach(stream.emit.bind(stream, 'data'));
63+
buffers.forEach(stream.push.bind(stream));
5664
};
5765
};
5866
}));

0 commit comments

Comments
 (0)