Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/numminorihsf/pg-ka-fix
Add TCP keep-alive to pg module
https://github.com/numminorihsf/pg-ka-fix
connection-pool node-postgres pg pg-ka
Last synced: 11 days ago
JSON representation
Add TCP keep-alive to pg module
- Host: GitHub
- URL: https://github.com/numminorihsf/pg-ka-fix
- Owner: NumminorihSF
- License: mit
- Created: 2016-04-13T00:40:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-14T10:05:53.000Z (over 8 years ago)
- Last Synced: 2024-10-06T05:22:45.760Z (about 1 month ago)
- Topics: connection-pool, node-postgres, pg, pg-ka
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#pg-ka-fix
This package fixes keep-alive problem of node-postgres package.
## Install
npm install pg-ka-fix
**Warning!** Package has no dependencies. To use pg - you should add it to your project dependencies.
## UsageTo fix pg, you just should execute function that is exported by this module:
require('pg-ka-fix')();
After that, if connection will be terminated - `pg.Client#query()`'s callback will emit error on 1st argument.
## ProblemThere is some BUG with connection pool in node-postgres lib.
To reproduce it - you need connect to postgresql, start request and kill db process by kill -9.
Client will not be free on any time. So, all client from client-pull was connected,
you will newer be able to do something with db without restarting of you application.Unfourtiantly, you there are more ways to kill db process, without your wish. For example, some cases with `plv8`
extension dropped our db process.## License
The MIT License (MIT)
Copyright (c) 2016 Konstantine Petryaev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.