transactions

This commit is contained in:
2018-12-19 16:28:51 +01:00
parent 4b691b54c8
commit 01acb126a4
3 changed files with 178 additions and 176 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*Generated on:Wed Dec 19 2018 16:24:02 GMT+0100 (CET)*/
/*Generated on:Wed Dec 19 2018 16:28:51 GMT+0100 (CET)*/
var AutomaticDispose_Branch = "master";
var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/";
var da_lss_adis_time = new Date().getTime();
+12 -11
View File
@@ -1,4 +1,4 @@
/*Generated on:Wed Dec 19 2018 16:24:02 GMT+0100 (CET)*/
/*Generated on:Wed Dec 19 2018 16:28:51 GMT+0100 (CET)*/
/*
* Dexie.js - a minimalistic wrapper for IndexedDB
* ===============================================
@@ -18126,10 +18126,10 @@ class AutomaticDispose {
ReadAndAddMissions(MissionID, Runner) {
const self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then(() => {
return self.ADisDB.transaction('r', [self.ADisDB.ADisMissions], async () => {
return self.ADSettings().then(async () => {
return self.ADisDB.ADisMissions.toCollection()
})
}).then((Missions) => {
if (typeof Missions !== "undefined") {
return Missions.count((count) => {
@@ -18157,8 +18157,7 @@ class AutomaticDispose {
});
})
}
});
});
});;
}
AddMission(ID, Runner) {
@@ -18306,11 +18305,13 @@ class AutomaticDispose {
RemoveMissionsFromQueue(MissionID) {
const self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.where({
missionID: MissionID
}).delete().catch((err) => {
console.error(err)
})
})
}
OpenNextMission(Runner) {
@@ -18329,7 +18330,7 @@ class AutomaticDispose {
// })
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then((setting) => {
return self.ADSettings().then((setting) => {
if (setting[runnerSettings] == 'true') {
return self.ADisDB.ADisMissions.where({
runner: Runner,
@@ -18339,6 +18340,7 @@ class AutomaticDispose {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
})
}).then((Wunsch) => {
// console.table(Wunsch);
if (Wunsch !== undefined) {
@@ -18369,7 +18371,6 @@ class AutomaticDispose {
}
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
});
});
}
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -18409,8 +18410,8 @@ class AutomaticDispose {
// return tellParent(`console.log('handler:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // delete Mission here as completed
// })
// } else {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => {
return self.ADisDB.transaction('r', [self.ADisDB.ADisMissions], () => {
return self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
@@ -18423,6 +18424,7 @@ class AutomaticDispose {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
})
}).then((Wunsch) => {
if (Wunsch !== undefined) {
return Wunsch.count(function (count) {
@@ -18443,7 +18445,6 @@ class AutomaticDispose {
})
}
})
})
// }
}, 500);
}
+11 -10
View File
@@ -885,10 +885,10 @@ class AutomaticDispose {
ReadAndAddMissions(MissionID, Runner) {
const self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then(() => {
return self.ADisDB.transaction('r', [self.ADisDB.ADisMissions], async () => {
return self.ADSettings().then(async () => {
return self.ADisDB.ADisMissions.toCollection()
})
}).then((Missions) => {
if (typeof Missions !== "undefined") {
return Missions.count((count) => {
@@ -916,8 +916,7 @@ class AutomaticDispose {
});
})
}
});
});
});;
}
AddMission(ID, Runner) {
@@ -1065,11 +1064,13 @@ class AutomaticDispose {
RemoveMissionsFromQueue(MissionID) {
const self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.where({
missionID: MissionID
}).delete().catch((err) => {
console.error(err)
})
})
}
OpenNextMission(Runner) {
@@ -1088,7 +1089,7 @@ class AutomaticDispose {
// })
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then((setting) => {
return self.ADSettings().then((setting) => {
if (setting[runnerSettings] == 'true') {
return self.ADisDB.ADisMissions.where({
runner: Runner,
@@ -1098,6 +1099,7 @@ class AutomaticDispose {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
})
}).then((Wunsch) => {
// console.table(Wunsch);
if (Wunsch !== undefined) {
@@ -1128,7 +1130,6 @@ class AutomaticDispose {
}
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
});
});
}
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -1168,8 +1169,8 @@ class AutomaticDispose {
// return tellParent(`console.log('handler:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // delete Mission here as completed
// })
// } else {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => {
return self.ADisDB.transaction('r', [self.ADisDB.ADisMissions], () => {
return self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
@@ -1182,6 +1183,7 @@ class AutomaticDispose {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
})
}).then((Wunsch) => {
if (Wunsch !== undefined) {
return Wunsch.count(function (count) {
@@ -1202,7 +1204,6 @@ class AutomaticDispose {
})
}
})
})
// }
}, 500);
}