1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Stop sqlite adding too many listeners

to close #630
This commit is contained in:
Dave Conway-Jones 2020-02-23 11:27:01 +00:00
parent 6c446a96f2
commit be5f79becc
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
2 changed files with 4 additions and 3 deletions

View File

@ -1,9 +1,9 @@
{ {
"name": "node-red-node-sqlite", "name": "node-red-node-sqlite",
"version": "0.4.1", "version": "0.4.2",
"description": "A sqlite node for Node-RED", "description": "A sqlite node for Node-RED",
"dependencies": { "dependencies": {
"sqlite3": "^4.1.0" "sqlite3": "~4.1.1"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -14,7 +14,8 @@ module.exports = function(RED) {
var node = this; var node = this;
node.doConnect = function() { node.doConnect = function() {
node.db = node.db || new sqlite3.Database(node.dbname,node.mode); if (node.db) { return; }
node.db = new sqlite3.Database(node.dbname,node.mode);
node.db.on('open', function() { node.db.on('open', function() {
if (node.tick) { clearTimeout(node.tick); } if (node.tick) { clearTimeout(node.tick); }
node.log("opened "+node.dbname+" ok"); node.log("opened "+node.dbname+" ok");