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 e1cc9275
authored
Mar 13, 2012
by
Meg Sharkey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for connection leak
1 parent
5b0e7fab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
lib/dialects/mysql/connector-manager.js
lib/dialects/mysql/connector-manager.js
View file @
e1cc927
...
...
@@ -14,6 +14,8 @@ module.exports = (function() {
}
Utils
.
_
.
extend
(
ConnectorManager
.
prototype
,
require
(
"../connector-manager"
).
prototype
)
var
isConnecting
=
false
ConnectorManager
.
prototype
.
query
=
function
(
sql
,
callee
,
options
)
{
if
(
!
this
.
isConnected
)
this
.
connect
()
...
...
@@ -29,7 +31,10 @@ module.exports = (function() {
ConnectorManager
.
prototype
.
connect
=
function
()
{
var
self
=
this
// in case database is slow to connect, prevent orphaning the client
if
(
this
.
isConnecting
)
{
return
}
this
.
client
=
require
(
"mysql"
).
createClient
({
user
:
this
.
config
.
username
,
password
:
this
.
config
.
password
,
...
...
@@ -39,11 +44,13 @@ module.exports = (function() {
})
this
.
client
.
setMaxListeners
(
this
.
maxConcurrentQueries
)
this
.
isConnecting
=
false
}
ConnectorManager
.
prototype
.
disconnect
=
function
()
{
var
self
=
this
this
.
client
.
end
(
function
()
{
// needed to prevent mysql connection leak
self
.
client
.
destroy
()
self
.
client
=
null
})
...
...
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