transactions

This commit is contained in:
2018-12-19 16:32:46 +01:00
parent 01acb126a4
commit 4ae5c26754
3 changed files with 44 additions and 12 deletions

View File

@@ -916,6 +916,8 @@ class AutomaticDispose {
});
})
}
}).catch((err) => {
console.error(err)
});;
}
@@ -1054,9 +1056,11 @@ class AutomaticDispose {
UpdateMissionsToDone(MissionID) {
const self = this;
return self.ADisDB.ADisMissions.update(MissionID, {
last_check: Math.floor(new Date().getTime() / 1000),
next_check: Math.floor(new Date().getTime() / 1000) + 120
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.update(MissionID, {
last_check: Math.floor(new Date().getTime() / 1000),
next_check: Math.floor(new Date().getTime() / 1000) + 120
})
}).catch((err) => {
console.error(err)
})
@@ -1070,6 +1074,8 @@ class AutomaticDispose {
}).delete().catch((err) => {
console.error(err)
})
}).catch((err) => {
console.error(err)
})
}
@@ -1129,6 +1135,8 @@ class AutomaticDispose {
});
}
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
}).catch((err) => {
console.error(err)
});
}
@@ -1169,8 +1177,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('r', [self.ADisDB.ADisMissions], () => {
return self.ADSettings().then((setting) => {
return self.ADisDB.transaction('r', [self.ADisDB.ADisMissions], async () => {
return self.ADSettings().then( async (setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
@@ -1203,6 +1211,8 @@ class AutomaticDispose {
return tellParent(`console.log('wunsch:2000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
})
}
}).catch((err) => {
console.error(err)
})
// }
}, 500);
@@ -1339,6 +1349,8 @@ class AutomaticDispose {
} else {
tellParent(`console.log('config:1000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
}
}).catch((err) => {
console.error(err)
});
} else {
tellParent(`console.log('config:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
@@ -1370,6 +1382,8 @@ class AutomaticDispose {
self.UpdateMissionsToDone(self.MissionID);
tellParent(`console.log('config:3000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
}
}).catch((err) => {
console.error(err)
});;
}
@@ -1439,6 +1453,8 @@ class AutomaticDispose {
});
}, 250);
}).catch((err) => {
console.error(err)
})