fix DB setup

This commit is contained in:
zadam
2020-06-20 21:42:41 +02:00
parent 6207203b35
commit 027afab6b1
19 changed files with 133 additions and 118 deletions

View File

@@ -1,6 +1,7 @@
const scriptService = require('./script');
const repository = require('./repository');
const cls = require('./cls');
const sqlInit = require('./sql_init');
function runNotesWithLabel(runAttrValue) {
const notes = repository.getEntities(`
@@ -20,8 +21,10 @@ function runNotesWithLabel(runAttrValue) {
}
}
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);
sqlInit.dbReady.then(() => {
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);
setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000);
setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000);
setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000);
setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000);
});