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 576b9555
authored
Nov 24, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark a pg connection as invalid on connection err. Builds on PR #2557 by @jawj
1 parent
f9db7aa5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
lib/dialects/postgres/connection-manager.js
lib/dialects/postgres/connection-manager.js
View file @
576b955
...
...
@@ -82,6 +82,11 @@ ConnectionManager.prototype.connect = function(config) {
reject
(
new
Error
(
'Connection timed out'
));
}
});
// Don't let a Postgres restart (or error) to take down the whole app
connection
.
on
(
'error'
,
function
(
err
,
client
)
{
connection
.
_invalid
=
true
;
});
}).
tap
(
function
(
connection
)
{
if
(
self
.
sequelize
.
config
.
keepDefaultTimezone
)
return
;
return
new
Promise
(
function
(
resolve
,
reject
)
{
...
...
@@ -100,4 +105,8 @@ ConnectionManager.prototype.disconnect = function(connection) {
});
};
ConnectionManager
.
prototype
.
validate
=
function
(
connection
)
{
return
connection
.
_invalid
===
undefined
;
};
module
.
exports
=
ConnectionManager
;
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