Skip to content

Commit

Permalink
Set noDelay to true
Browse files Browse the repository at this point in the history
  • Loading branch information
brianc committed May 12, 2020
1 parent 520bd35 commit 08afb12
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/pg/lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Connection.prototype.connect = function (port, host) {
var self = this

this._connecting = true
this.stream.setNoDelay(true)
this.stream.connect(port, host)

this.stream.once('connect', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var Client = require(__dirname + '/../../../lib/client')

test('emits end when not in query', function () {
var stream = new (require('events').EventEmitter)()
stream.setNoDelay = () => {}
stream.connect = function () {
// NOOP
}
Expand Down
2 changes: 2 additions & 0 deletions packages/pg/test/unit/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ p.connect = function () {
// NOOP
}

p.setNoDelay = () => {}

p.write = function (packet, cb) {
this.packets.push(packet)
if (cb) {
Expand Down

0 comments on commit 08afb12

Please sign in to comment.