Add --skip-unchanged flag to cache-asset-manifests

I'm not getting cron success _or_ cron failure emails for running this script on our Linode box. I was getting failures back when I had the command wrong, though.

My hypothesis is that the script output is too long to email, because of some limit somewhere along the way. I'll update the cron job to use `--skip-unchanged`, in hopes that it helps me get the emails! (I'm not suuure it's running, is the thing... though hey, here's a way to check: as of now, 512,624 of 521,896 assets are converted. If that changes eventually without a manual script run, then the cron is working!)
This commit is contained in:
Emi Matchu 2021-01-21 10:38:47 -08:00
parent 353f90dcac
commit 79258e11b9

View file

@ -69,12 +69,15 @@ async function cacheAssetManifests(db) {
numRowsDone++; numRowsDone++;
const percent = Math.floor((numRowsDone / numRowsTotal) * 100); const percent = Math.floor((numRowsDone / numRowsTotal) * 100);
// write to stderr, to not disrupt the dump const shouldSkipLogging = argv.skipUnchanged && !updated;
console.error( if (!shouldSkipLogging) {
`${percent}% ${numRowsDone}/${numRowsTotal} ` + // write to stderr, to not disrupt the dump
`(Exists? ${Boolean(manifest)}. Updated? ${updated}. ` + console.error(
`Layer: ${row.id}, ${row.url}.)` `${percent}% ${numRowsDone}/${numRowsTotal} ` +
); `(Exists? ${Boolean(manifest)}. Updated? ${updated}. ` +
`Layer: ${row.id}, ${row.url}.)`
);
}
} catch (e) { } catch (e) {
console.error(`Error loading layer ${row.id}, ${row.url}.`, e); console.error(`Error loading layer ${row.id}, ${row.url}.`, e);
} }