Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit dcf079b2
authored
Jun 11, 2019
by
Sushant
Committed by
GitHub
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update sequelize-pool (#11055)
1 parent
3a494ee6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
29 deletions
lib/dialects/abstract/connection-manager.js
package.json
test/integration/sequelize.test.js
lib/dialects/abstract/connection-manager.js
View file @
dcf079b
'use strict'
;
'use strict'
;
const
{
Pool
}
=
require
(
'sequelize-pool'
);
const
{
Pool
,
TimeoutError
}
=
require
(
'sequelize-pool'
);
const
_
=
require
(
'lodash'
);
const
_
=
require
(
'lodash'
);
const
semver
=
require
(
'semver'
);
const
semver
=
require
(
'semver'
);
const
Promise
=
require
(
'../../promise'
);
const
Promise
=
require
(
'../../promise'
);
...
@@ -278,9 +278,11 @@ class ConnectionManager {
...
@@ -278,9 +278,11 @@ class ConnectionManager {
return
promise
.
then
(()
=>
{
return
promise
.
then
(()
=>
{
return
this
.
pool
.
acquire
(
options
.
type
,
options
.
useMaster
)
return
this
.
pool
.
acquire
(
options
.
type
,
options
.
useMaster
)
.
catch
(
Promise
.
TimeoutError
,
err
=>
{
throw
new
errors
.
ConnectionAcquireTimeoutError
(
err
);
})
.
catch
(
error
=>
{
.
tap
(()
=>
{
debug
(
'connection acquired'
);
});
if
(
error
instanceof
TimeoutError
)
throw
new
errors
.
ConnectionAcquireTimeoutError
(
error
);
});
throw
error
;
});
}).
tap
(()
=>
{
debug
(
'connection acquired'
);
});
}
}
/**
/**
...
...
package.json
View file @
dcf079b
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
"moment-timezone"
:
"^0.5.21"
,
"moment-timezone"
:
"^0.5.21"
,
"retry-as-promised"
:
"^3.1.0"
,
"retry-as-promised"
:
"^3.1.0"
,
"semver"
:
"^5.6.0"
,
"semver"
:
"^5.6.0"
,
"sequelize-pool"
:
"^
1.0.2
"
,
"sequelize-pool"
:
"^
2.1.0
"
,
"toposort-class"
:
"^1.0.1"
,
"toposort-class"
:
"^1.0.1"
,
"uuid"
:
"^3.2.1"
,
"uuid"
:
"^3.2.1"
,
"validator"
:
"^10.11.0"
,
"validator"
:
"^10.11.0"
,
...
...
test/integration/sequelize.test.js
View file @
dcf079b
...
@@ -294,19 +294,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
...
@@ -294,19 +294,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
});
});
describe
(
'logging'
,
()
=>
{
describe
(
'logging'
,
()
=>
{
it
(
'executes a query with global benchmarking option and default logger'
,
()
=>
{
const
logger
=
sinon
.
stub
(
console
,
'log'
);
const
sequelize
=
Support
.
createSequelizeInstance
({
logging
:
logger
,
benchmark
:
true
});
return
sequelize
.
query
(
'select 1;'
).
then
(()
=>
{
expect
(
logger
.
calledOnce
).
to
.
be
.
true
;
expect
(
logger
.
args
[
0
][
0
]).
to
.
be
.
match
(
/Executed
\((\d
*|default
)\)
: select 1; Elapsed time:
\d
+ms/
);
});
});
it
(
'executes a query with global benchmarking option and custom logger'
,
()
=>
{
it
(
'executes a query with global benchmarking option and custom logger'
,
()
=>
{
const
logger
=
sinon
.
spy
();
const
logger
=
sinon
.
spy
();
const
sequelize
=
Support
.
createSequelizeInstance
({
const
sequelize
=
Support
.
createSequelizeInstance
({
...
@@ -321,17 +308,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
...
@@ -321,17 +308,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
});
});
});
});
it
(
'executes a query with benchmarking option and default logger'
,
function
()
{
const
logger
=
sinon
.
stub
(
console
,
'log'
);
return
this
.
sequelize
.
query
(
'select 1;'
,
{
logging
:
logger
,
benchmark
:
true
}).
then
(()
=>
{
expect
(
logger
.
calledOnce
).
to
.
be
.
true
;
expect
(
logger
.
args
[
0
][
0
]).
to
.
be
.
match
(
/Executed
\((\d
*|default
)\)
: select 1; Elapsed time:
\d
+ms/
);
});
});
it
(
'executes a query with benchmarking option and custom logger'
,
function
()
{
it
(
'executes a query with benchmarking option and custom logger'
,
function
()
{
const
logger
=
sinon
.
spy
();
const
logger
=
sinon
.
spy
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment