From 79258e11b9cd4199fd394c9dfb6e4760c89b71ba Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 21 Jan 2021 10:38:47 -0800 Subject: [PATCH] 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!) --- scripts/cache-asset-manifests.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/cache-asset-manifests.js b/scripts/cache-asset-manifests.js index 8171317..185e7c1 100644 --- a/scripts/cache-asset-manifests.js +++ b/scripts/cache-asset-manifests.js @@ -69,12 +69,15 @@ async function cacheAssetManifests(db) { numRowsDone++; const percent = Math.floor((numRowsDone / numRowsTotal) * 100); - // write to stderr, to not disrupt the dump - console.error( - `${percent}% ${numRowsDone}/${numRowsTotal} ` + - `(Exists? ${Boolean(manifest)}. Updated? ${updated}. ` + - `Layer: ${row.id}, ${row.url}.)` - ); + const shouldSkipLogging = argv.skipUnchanged && !updated; + if (!shouldSkipLogging) { + // write to stderr, to not disrupt the dump + console.error( + `${percent}% ${numRowsDone}/${numRowsTotal} ` + + `(Exists? ${Boolean(manifest)}. Updated? ${updated}. ` + + `Layer: ${row.id}, ${row.url}.)` + ); + } } catch (e) { console.error(`Error loading layer ${row.id}, ${row.url}.`, e); }