log when finished

This commit is contained in:
Namekuji 2023-09-06 04:09:51 -04:00
parent 7f00bace29
commit af29002d5d
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532

View file

@ -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;
} }