Мелкий рефакторинг
This commit is contained in:
@@ -462,11 +462,7 @@ class DbCreator {
|
|||||||
titleRec.id = ++id;
|
titleRec.id = ++id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//config
|
//stats
|
||||||
await db.create({
|
|
||||||
table: 'config'
|
|
||||||
});
|
|
||||||
|
|
||||||
const stats = {
|
const stats = {
|
||||||
filesCount: 0,
|
filesCount: 0,
|
||||||
recsLoaded,
|
recsLoaded,
|
||||||
@@ -483,14 +479,6 @@ class DbCreator {
|
|||||||
};
|
};
|
||||||
//console.log(stats);
|
//console.log(stats);
|
||||||
|
|
||||||
const inpxHashCreator = new InpxHashCreator(config);
|
|
||||||
|
|
||||||
await db.insert({table: 'config', rows: [
|
|
||||||
{id: 'inpxInfo', value: (inpxFilter && inpxFilter.info ? inpxFilter.info : parser.info)},
|
|
||||||
{id: 'stats', value: stats},
|
|
||||||
{id: 'inpxHash', value: await inpxHashCreator.getHash()},
|
|
||||||
]});
|
|
||||||
|
|
||||||
//сохраним поисковые таблицы
|
//сохраним поисковые таблицы
|
||||||
const chunkSize = 10000;
|
const chunkSize = 10000;
|
||||||
|
|
||||||
@@ -577,6 +565,19 @@ class DbCreator {
|
|||||||
await db.freeMemory();
|
await db.freeMemory();
|
||||||
utils.freeMemory();
|
utils.freeMemory();
|
||||||
|
|
||||||
|
//config сохраняем в самом конце, нет конфига - с базой что-то не так
|
||||||
|
const inpxHashCreator = new InpxHashCreator(config);
|
||||||
|
|
||||||
|
await db.create({
|
||||||
|
table: 'config'
|
||||||
|
});
|
||||||
|
|
||||||
|
await db.insert({table: 'config', rows: [
|
||||||
|
{id: 'inpxInfo', value: (inpxFilter && inpxFilter.info ? inpxFilter.info : parser.info)},
|
||||||
|
{id: 'stats', value: stats},
|
||||||
|
{id: 'inpxHash', value: await inpxHashCreator.getHash()},
|
||||||
|
]});
|
||||||
|
|
||||||
callback({job: 'done', jobMessage: ''});
|
callback({job: 'done', jobMessage: ''});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -689,12 +690,9 @@ class DbCreator {
|
|||||||
});
|
});
|
||||||
`});
|
`});
|
||||||
|
|
||||||
if (countRes.length) {
|
if (countRes.length)
|
||||||
stats.filesCount = countRes[0].count;
|
stats.filesCount = countRes[0].count;
|
||||||
await db.insert({table: 'config', replace: true, rows: [
|
|
||||||
{id: 'stats', value: stats},
|
|
||||||
]});
|
|
||||||
}
|
|
||||||
countDone = true;
|
countDone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user