Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeremija/db-keep-alive
Executes a keep-alive query on a database connection object every n seconds to keep it alive
https://github.com/jeremija/db-keep-alive
Last synced: 9 days ago
JSON representation
Executes a keep-alive query on a database connection object every n seconds to keep it alive
- Host: GitHub
- URL: https://github.com/jeremija/db-keep-alive
- Owner: jeremija
- Created: 2015-10-12T18:14:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-12T18:24:54.000Z (about 9 years ago)
- Last Synced: 2024-09-16T19:43:09.484Z (about 2 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# db-keep-alive
Executes a keep-alive query through a database connection object every `n`
seconds. Tested with `mysql` module.The default query is set to:
```
SELECT 1
```# Usage
```javascript
// execute every 60 seconds
var pinger = require('db-keep-alive').create_pinger(connection, 60, 'SELECT 1');// start the interval timeout
pinger.start();// stop the interval timeout
pinger.stop();// change the underlying connection and start
pinger.set_connection(connection2).start();
```