mysql-live-select
Advanced tools
Comparing version 0.0.21 to 0.0.22
@@ -6,2 +6,5 @@ /* mysql-live-select, MIT License ben@latenightsketches.com | ||
// Maximum duration to wait for Zongji to initialize before timeout error (ms) | ||
var ZONGJI_INIT_TIMEOUT = 1500; | ||
var LiveMysqlSelect = require('./LiveMysqlSelect'); | ||
@@ -67,4 +70,20 @@ | ||
// Wait for Zongji to be ready before executing callback | ||
var zongjiInitTime = Date.now(); | ||
var zongjiReady = function() { | ||
if(zongji.ready === true) { | ||
// Call the callback if it exists and do not keep waiting | ||
callback && callback(); | ||
} else { | ||
// Wait for Zongji to be ready | ||
if(Date.now() - zongjiInitTime > ZONGJI_INIT_TIMEOUT) { | ||
// Zongji initialization has exceeded timeout, callback error | ||
callback && callback(new Error('ZONGJI_INIT_TIMEOUT_OCCURED')); | ||
} else { | ||
setTimeout(zongjiReady, 40); | ||
} | ||
} | ||
}; | ||
zongji.start(self.zongjiSettings); | ||
if(callback) return callback(); | ||
zongjiReady(); | ||
}); | ||
@@ -71,0 +90,0 @@ } |
{ | ||
"name": "mysql-live-select", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "Live updating MySQL SELECT statements", | ||
@@ -5,0 +5,0 @@ "main": "lib/LiveMysql.js", |
@@ -245,2 +245,9 @@ /* mysql-live-select, MIT License ben@latenightsketches.com | ||
}, | ||
immediate_disconnection: function(test){ | ||
var myTest = new LiveMysql(settings, function(error){ | ||
myTest.end(); | ||
test.ok(typeof error === 'undefined'); | ||
test.done(); | ||
}); | ||
}, | ||
error_invalid_connection: function(test){ | ||
@@ -247,0 +254,0 @@ var myTest = new LiveMysql({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36800
681