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,7 +23,10 @@ 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(
"SELECT * FROM note",
[],
(n, row) => {
if (n % 1000 === 0) { if (n % 1000 === 0) {
job.progress(((n / total) * 100).toFixed(1)); job.progress(((n / total) * 100).toFixed(1));
logger.info(`Indexed notes ${n}/${total}`); logger.info(`Indexed notes ${n}/${total}`);
@ -34,10 +37,17 @@ export default async function indexAllNotes(
} else { } else {
index(note, true); index(note, true);
} }
}); },
(err, _) => {
done(); if (err.message) {
logger.error(err);
} else {
logger.info("All notes have been indexed."); logger.info("All notes have been indexed.");
}
done();
},
);
return; return;
} }