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 c94219cf
authored
May 28, 2016
by
K.J. Valencik
Committed by
Jan Aagaard Meier
May 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MSSQL disconnect handling (#5967)
1 parent
d2545644
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
3 deletions
changelog.md
lib/dialects/mssql/connection-manager.js
test/integration/dialects/mssql/connection-manager.test.js
changelog.md
View file @
c94219c
# Future (4.0.0-pre1)
# Future (4.0.0-pre1)
-
[
FIXED
]
Pass ResourceLock instead of raw connection in MSSQL disconnect handling
-
[
CHANGED
]
Remove
`hookValidate`
in favor of
`validate`
with
`hooks: true | false`
.
-
[
CHANGED
]
Remove
`hookValidate`
in favor of
`validate`
with
`hooks: true | false`
.
-
[
REMOVED
]
Support for
`referencesKey`
-
[
REMOVED
]
Support for
`referencesKey`
-
[
CHANGED
]
Throw if
`dialect`
is not provided to the constructor
-
[
CHANGED
]
Throw if
`dialect`
is not provided to the constructor
...
...
lib/dialects/mssql/connection-manager.js
View file @
c94219c
...
@@ -65,12 +65,13 @@ ConnectionManager.prototype.connect = function(config) {
...
@@ -65,12 +65,13 @@ ConnectionManager.prototype.connect = function(config) {
});
});
}
}
var
connection
=
new
self
.
lib
.
Connection
(
connectionConfig
);
var
connection
=
new
self
.
lib
.
Connection
(
connectionConfig
)
,
connectionLock
=
new
ResourceLock
(
connection
);
connection
.
lib
=
self
.
lib
;
connection
.
lib
=
self
.
lib
;
connection
.
on
(
'connect'
,
function
(
err
)
{
connection
.
on
(
'connect'
,
function
(
err
)
{
if
(
!
err
)
{
if
(
!
err
)
{
resolve
(
new
ResourceLock
(
connection
)
);
resolve
(
connectionLock
);
return
;
return
;
}
}
...
@@ -115,7 +116,7 @@ ConnectionManager.prototype.connect = function(config) {
...
@@ -115,7 +116,7 @@ ConnectionManager.prototype.connect = function(config) {
switch
(
err
.
code
)
{
switch
(
err
.
code
)
{
case
'ESOCKET'
:
case
'ESOCKET'
:
case
'ECONNRESET'
:
case
'ECONNRESET'
:
self
.
pool
.
destroy
(
connection
);
self
.
pool
.
destroy
(
connection
Lock
);
}
}
});
});
}
}
...
...
test/integration/dialects/mssql/connection-manager.test.js
0 → 100644
View file @
c94219c
'use strict'
;
/* jshint -W030 */
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
Support
=
require
(
'../../support'
)
,
dialect
=
Support
.
getTestDialect
();
if
(
dialect
.
match
(
/^mssql/
))
{
describe
(
'[MSSQL Specific] Query Queue'
,
function
()
{
it
(
'should work with handleDisconnects'
,
function
()
{
var
sequelize
=
Support
.
createSequelizeInstance
({
pool
:
{
min
:
1
,
max
:
1
,
idle
:
5000
}})
,
cm
=
sequelize
.
connectionManager
,
conn
;
return
sequelize
.
sync
()
.
then
(
function
()
{
return
cm
.
getConnection
();
})
.
then
(
function
(
connection
)
{
// Save current connection
conn
=
connection
;
// simulate a unexpected end
connection
.
unwrap
().
emit
(
'error'
,
{
code
:
'ECONNRESET'
});
})
.
then
(
function
()
{
return
cm
.
releaseConnection
(
conn
);
})
.
then
(
function
()
{
// Get next available connection
return
cm
.
getConnection
();
})
.
then
(
function
(
connection
)
{
expect
(
conn
).
to
.
not
.
be
.
equal
(
connection
);
expect
(
cm
.
validate
(
conn
)).
to
.
not
.
be
.
ok
;
return
cm
.
releaseConnection
(
connection
);
});
});
});
}
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