log when finished
This commit is contained in:
parent
7f00bace29
commit
af29002d5d
1 changed files with 24 additions and 14 deletions
|
@ -23,21 +23,31 @@ export default async function indexAllNotes(
|
||||||
|
|
||||||
if (scyllaClient) {
|
if (scyllaClient) {
|
||||||
total = await fetchPostCount(false);
|
total = await fetchPostCount(false);
|
||||||
scyllaClient.eachRow("SELECT * FROM note", [], (n, row) => {
|
scyllaClient.eachRow(
|
||||||
if (n % 1000 === 0) {
|
"SELECT * FROM note",
|
||||||
job.progress(((n / total) * 100).toFixed(1));
|
[],
|
||||||
logger.info(`Indexed notes ${n}/${total}`);
|
(n, row) => {
|
||||||
}
|
if (n % 1000 === 0) {
|
||||||
const note = parseScyllaNote(row);
|
job.progress(((n / total) * 100).toFixed(1));
|
||||||
if (meilisearch) {
|
logger.info(`Indexed notes ${n}/${total}`);
|
||||||
meilisearch.ingestNote([note]).then(() => index(note, true));
|
}
|
||||||
} else {
|
const note = parseScyllaNote(row);
|
||||||
index(note, true);
|
if (meilisearch) {
|
||||||
}
|
meilisearch.ingestNote([note]).then(() => index(note, true));
|
||||||
});
|
} else {
|
||||||
|
index(note, true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err, _) => {
|
||||||
|
if (err.message) {
|
||||||
|
logger.error(err);
|
||||||
|
} else {
|
||||||
|
logger.info("All notes have been indexed.");
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
done();
|
|
||||||
logger.info("All notes have been indexed.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue