Skip to content

Commit b1976ae

Browse files
authored
fix: lint
1 parent c808c23 commit b1976ae

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

packages/pg/lib/pipeline-tests.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ suite.test('pipeline mode basic functionality', (cb) => {
1010
const client = new pg.Client(helper.config)
1111
client.connect((err) => {
1212
if (err) return cb(err)
13-
13+
1414
// Initially not in pipeline mode
1515
assert.equal(client.pipelineStatus(), 'PIPELINE_OFF')
1616
assert.equal(client.pipelining, false)
17-
17+
1818
// Enable pipeline mode
1919
client.pipelining = true
2020
assert.equal(client.pipelineStatus(), 'PIPELINE_ON')
2121
assert.equal(client.pipelining, true)
22-
22+
2323
// Disable pipeline mode
2424
client.pipelining = false
2525
assert.equal(client.pipelineStatus(), 'PIPELINE_OFF')
2626
assert.equal(client.pipelining, false)
27-
27+
2828
client.end(cb)
2929
})
3030
})
3131

3232
suite.test('cannot enable pipeline before connection', (cb) => {
3333
const client = new pg.Client(helper.config)
34-
34+
3535
try {
3636
client.pipelining = true
3737
cb(new Error('Should have thrown error'))
@@ -45,34 +45,34 @@ suite.test('pipeline mode with multiple queries', (cb) => {
4545
const client = new pg.Client(helper.config)
4646
client.connect((err) => {
4747
if (err) return cb(err)
48-
48+
4949
client.pipelining = true
50-
50+
5151
let results = []
5252
let completed = 0
53-
53+
5454
// Send multiple queries in pipeline mode
5555
client.query('SELECT 1 as num', (err, res) => {
5656
if (err) return cb(err)
5757
results[0] = res.rows[0].num
5858
completed++
5959
if (completed === 3) checkResults()
6060
})
61-
61+
6262
client.query('SELECT 2 as num', (err, res) => {
6363
if (err) return cb(err)
6464
results[1] = res.rows[0].num
6565
completed++
6666
if (completed === 3) checkResults()
6767
})
68-
68+
6969
client.query('SELECT 3 as num', (err, res) => {
7070
if (err) return cb(err)
7171
results[2] = res.rows[0].num
7272
completed++
7373
if (completed === 3) checkResults()
7474
})
75-
75+
7676
function checkResults() {
7777
assert.equal(results[0], 1)
7878
assert.equal(results[1], 2)
@@ -86,9 +86,9 @@ suite.test('pipeline mode rejects simple query protocol', (cb) => {
8686
const client = new pg.Client(helper.config)
8787
client.connect((err) => {
8888
if (err) return cb(err)
89-
89+
9090
client.pipelining = true
91-
91+
9292
try {
9393
client.query('SELECT 1', (err, res) => {
9494
// This should not be called
@@ -105,9 +105,9 @@ suite.test('pipeline mode rejects multiple SQL commands', (cb) => {
105105
const client = new pg.Client(helper.config)
106106
client.connect((err) => {
107107
if (err) return cb(err)
108-
108+
109109
client.pipelining = true
110-
110+
111111
try {
112112
client.query({ text: 'SELECT 1; SELECT 2;' }, (err, res) => {
113113
// This should not be called
@@ -124,27 +124,27 @@ suite.test('pipeline mode with parameterized queries', (cb) => {
124124
const client = new pg.Client(helper.config)
125125
client.connect((err) => {
126126
if (err) return cb(err)
127-
127+
128128
client.pipelining = true
129-
129+
130130
let results = []
131131
let completed = 0
132-
132+
133133
// Send parameterized queries in pipeline mode
134134
client.query({ text: 'SELECT $1::int as num', values: [10] }, (err, res) => {
135135
if (err) return cb(err)
136136
results[0] = res.rows[0].num
137137
completed++
138138
if (completed === 2) checkResults()
139139
})
140-
140+
141141
client.query({ text: 'SELECT $1::text as str', values: ['hello'] }, (err, res) => {
142142
if (err) return cb(err)
143143
results[1] = res.rows[0].str
144144
completed++
145145
if (completed === 2) checkResults()
146146
})
147-
147+
148148
function checkResults() {
149149
assert.equal(results[0], 10)
150150
assert.equal(results[1], 'hello')
@@ -157,9 +157,9 @@ suite.test('pipeline mode performance benefit', (cb) => {
157157
const client = new pg.Client(helper.config)
158158
client.connect((err) => {
159159
if (err) return cb(err)
160-
160+
161161
const numQueries = 10
162-
162+
163163
// Test without pipeline mode
164164
const startNormal = Date.now()
165165
let normalCompleted = 0
@@ -176,29 +176,29 @@ suite.test('pipeline mode performance benefit', (cb) => {
176176
})
177177
}
178178
}
179-
179+
180180
function runPipelineQueries(normalTime) {
181181
client.pipelining = true
182182
const startPipeline = Date.now()
183183
let pipelineCompleted = 0
184-
184+
185185
for (let i = 0; i < numQueries; i++) {
186186
client.query({ text: 'SELECT $1::int as num', values: [i] }, (err, res) => {
187187
if (err) return cb(err)
188188
pipelineCompleted++
189189
if (pipelineCompleted === numQueries) {
190190
const pipelineTime = Date.now() - startPipeline
191-
191+
192192
// Pipeline should be faster or at least not significantly slower
193193
// In real network conditions with latency, pipeline would show more benefit
194194
console.log(`Normal mode: ${normalTime}ms, Pipeline mode: ${pipelineTime}ms`)
195-
195+
196196
client.end(cb)
197197
}
198198
})
199199
}
200200
}
201-
201+
202202
runNormalQueries()
203203
})
204204
})

0 commit comments

Comments
 (0)