Fixed minor bugs

- Fixed: Infinite sync loop occurring in receiver end
- Fixed: clearUnauthorisedAppData SQL statement
This commit is contained in:
sairajzero 2022-12-21 04:17:18 +05:30
parent 49dce2b8b6
commit 5bca07d2d6
2 changed files with 2 additions and 2 deletions

View File

@ -80,6 +80,7 @@ const queueSync = {
console.warn(`Queue-Sync: queue list is empty, but hash list is not empty for ${node_i}`);
//all blocks synced, remove the sync instance
console.info(`END: Data sync for ${node_i}`);
clearInterval(r.check_interval);
delete this.list[node_i];
//indicate next node for ordering
_nextNode.send(packet_.construct({

View File

@ -476,12 +476,11 @@ DB.clearAuthorisedAppData = function (snID, app, adminID, subAdmins, timestamp)
DB.clearUnauthorisedAppData = function (snID, appList, timestamp) {
return new Promise((resolve, reject) => {
let statement = "SELECT * FROM _" + snID +
let statement = "DELETE FROM _" + snID +
" WHERE " + H_struct.TIME + "<?" +
(appList.length ? " AND " +
H_struct.APPLICATION + " NOT IN (" + appList.map(a => "?").join(", ") + ")" :
"");
console.debug(statement, [timestamp].concat(appList))
queryResolve(statement, [timestamp].concat(appList))
.then(result => resolve(result))
.catch(error => reject(error));