db-keep-alive

1.0.2 • Public • Published

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

// 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();

Readme

Keywords

Package Sidebar

Install

npm i db-keep-alive

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jeremija