Skip to content

Commit dcf079b

Browse files
fix: update sequelize-pool (#11055)
1 parent 3a494ee commit dcf079b

File tree

3 files changed

+7
-29
lines changed

3 files changed

+7
-29
lines changed

lib/dialects/abstract/connection-manager.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { Pool } = require('sequelize-pool');
3+
const { Pool, TimeoutError } = require('sequelize-pool');
44
const _ = require('lodash');
55
const semver = require('semver');
66
const Promise = require('../../promise');
@@ -278,9 +278,11 @@ class ConnectionManager {
278278

279279
return promise.then(() => {
280280
return this.pool.acquire(options.type, options.useMaster)
281-
.catch(Promise.TimeoutError, err => { throw new errors.ConnectionAcquireTimeoutError(err); })
282-
.tap(() => { debug('connection acquired'); });
283-
});
281+
.catch(error => {
282+
if (error instanceof TimeoutError) throw new errors.ConnectionAcquireTimeoutError(error);
283+
throw error;
284+
});
285+
}).tap(() => { debug('connection acquired'); });
284286
}
285287

286288
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"moment-timezone": "^0.5.21",
4141
"retry-as-promised": "^3.1.0",
4242
"semver": "^5.6.0",
43-
"sequelize-pool": "^1.0.2",
43+
"sequelize-pool": "^2.1.0",
4444
"toposort-class": "^1.0.1",
4545
"uuid": "^3.2.1",
4646
"validator": "^10.11.0",

test/integration/sequelize.test.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -294,19 +294,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
294294
});
295295

296296
describe('logging', () => {
297-
it('executes a query with global benchmarking option and default logger', () => {
298-
const logger = sinon.stub(console, 'log');
299-
const sequelize = Support.createSequelizeInstance({
300-
logging: logger,
301-
benchmark: true
302-
});
303-
304-
return sequelize.query('select 1;').then(() => {
305-
expect(logger.calledOnce).to.be.true;
306-
expect(logger.args[0][0]).to.be.match(/Executed \((\d*|default)\): select 1; Elapsed time: \d+ms/);
307-
});
308-
});
309-
310297
it('executes a query with global benchmarking option and custom logger', () => {
311298
const logger = sinon.spy();
312299
const sequelize = Support.createSequelizeInstance({
@@ -321,17 +308,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
321308
});
322309
});
323310

324-
it('executes a query with benchmarking option and default logger', function() {
325-
const logger = sinon.stub(console, 'log');
326-
return this.sequelize.query('select 1;', {
327-
logging: logger,
328-
benchmark: true
329-
}).then(() => {
330-
expect(logger.calledOnce).to.be.true;
331-
expect(logger.args[0][0]).to.be.match(/Executed \((\d*|default)\): select 1; Elapsed time: \d+ms/);
332-
});
333-
});
334-
335311
it('executes a query with benchmarking option and custom logger', function() {
336312
const logger = sinon.spy();
337313

0 commit comments

Comments
 (0)