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 1c8fbbee
authored
Oct 23, 2014
by
José Moreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add `.destroy` proxy method into CM
1 parent
0d4f37bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
lib/dialects/abstract/connection-manager.js
lib/dialects/mysql/connection-manager.js
lib/dialects/abstract/connection-manager.js
View file @
1c8fbbe
...
...
@@ -113,6 +113,9 @@ ConnectionManager.prototype.initPools = function () {
self
.
pool
.
write
.
acquire
(
callback
,
priority
);
}
},
destroy
:
function
(
connection
)
{
return
self
.
pool
[
connection
.
queryType
].
destroy
(
connection
);
},
drain
:
function
()
{
self
.
pool
.
read
.
drain
();
self
.
pool
.
write
.
drain
();
...
...
lib/dialects/mysql/connection-manager.js
View file @
1c8fbbe
...
...
@@ -67,12 +67,8 @@ ConnectionManager.prototype.connect = function(config) {
// See [stackoverflow answer](http://stackoverflow.com/questions/20210522/nodejs-mysql-error-connection-lost-the-server-closed-the-connection)
connection
.
on
(
'error'
,
function
(
err
)
{
if
(
err
.
code
===
'PROTOCOL_CONNECTION_LOST'
)
{
// Get the right read/write pool in case of replication, otherwise use generic pool
var
pool
=
config
.
replication
?
self
.
pool
[
connection
.
queryType
]
:
self
.
pool
;
// Remove it from read/write pool
pool
.
destroy
(
connection
);
self
.
pool
.
destroy
(
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