mirror of
https://dev.s-ul.net/Galexion/MaiMaiDXNet.git
synced 2024-11-12 04:30:51 +01:00
i should have just done this all along galexion your a stupid bitch ass motherfucker who doesnt know jack shit about coding
This commit is contained in:
parent
39fb90e14b
commit
c649338fdd
24
dbhandler.js
24
dbhandler.js
@ -11,20 +11,8 @@ if (serverType === 1) {
|
||||
function establishConnection() {
|
||||
return new Promise((resolve, reject) => {
|
||||
pool.getConnection(function(err, con) {
|
||||
if (err) throw err; // not connected!
|
||||
if (err) console.error("ERR: You lost a connection.\n" + err ); // not connected!
|
||||
resolve(con);
|
||||
con.on('error', function(err) {
|
||||
console.log('MySQL error', err);
|
||||
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
|
||||
console.log('Reconnecting MySQL connection...');
|
||||
con = mysql.createConnection(connection.config);
|
||||
pool.getConnection(function(err, connection) {
|
||||
if (err) throw err; // not connected!
|
||||
});
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -52,8 +40,8 @@ async function getUserCount() {
|
||||
reject(err)
|
||||
throw err
|
||||
};
|
||||
resolve(JSON.parse(JSON.stringify(result)).length);
|
||||
con.release();
|
||||
resolve(JSON.parse(JSON.stringify(result)).length);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -106,8 +94,8 @@ async function getUserData(req) {
|
||||
}
|
||||
if (mUser) {
|
||||
// Return a Response with the whole identifiable user data. the EXT_ID will be used later to identify images and other things and match them to the user's profile.
|
||||
resolve(mUser);
|
||||
con.release();
|
||||
resolve(mUser);
|
||||
} else {
|
||||
reject(new Error('User not found'));
|
||||
}
|
||||
@ -160,8 +148,8 @@ async function getExtId(req) {
|
||||
}
|
||||
if (mUser) {
|
||||
// Return a Response with the whole identifiable user data. the EXT_ID will be used later to identify images and other things and match them to the user's profile.
|
||||
resolve(mUser);
|
||||
con.release();
|
||||
resolve(mUser);
|
||||
} else {
|
||||
reject(new Error('User not found'));
|
||||
}
|
||||
@ -214,8 +202,8 @@ async function getUserScores(req) {
|
||||
}
|
||||
}
|
||||
// Return a Response with all the Scores listed under that user.
|
||||
resolve(mUser)
|
||||
con.release();
|
||||
resolve(mUser);
|
||||
})
|
||||
});
|
||||
}
|
||||
@ -266,8 +254,8 @@ async function getUserArea(req) {
|
||||
}
|
||||
}
|
||||
// Return a Response with all the Scores listed under that user.
|
||||
resolve(mUser)
|
||||
con.release();
|
||||
resolve(mUser)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user