mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-06 05:05:23 +03:00
Merge pull request #2541 from nzalev/fix-hanging
Bail if unable to connect to db
This commit is contained in:
commit
3f235b0464
5
db.js
5
db.js
@ -467,7 +467,10 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
// Set the default database for the rest of this connections lifetime
|
// Set the default database for the rest of this connections lifetime
|
||||||
var useDatabase = 'USE ' + dbname;
|
var useDatabase = 'USE ' + dbname;
|
||||||
sqlDbQuery(useDatabase, null, function (err, docs) {
|
sqlDbQuery(useDatabase, null, function (err, docs) {
|
||||||
if (err != null) { console.log(err); parent.debug('db', 'ERROR: ' + useDatabase + ': ' + err); }
|
if (err != null) {
|
||||||
|
console.log("Unable to connect to database: " + err);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
if (err == null) {
|
if (err == null) {
|
||||||
parent.debug('db', 'Checking tables...');
|
parent.debug('db', 'Checking tables...');
|
||||||
sqlDbBatchExec([
|
sqlDbBatchExec([
|
||||||
|
Loading…
Reference in New Issue
Block a user