From cfbb23d9ff2c4eacc4df6975239847d4b89efc96 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 11 Mar 2021 02:23:40 -0800 Subject: [PATCH] Keep track of when manifest was last cached Can use this later to make sure we re-run them on a regular interval or something! --- scripts/cache-asset-manifests.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/cache-asset-manifests.js b/scripts/cache-asset-manifests.js index cfdb4c8..aa3d616 100644 --- a/scripts/cache-asset-manifests.js +++ b/scripts/cache-asset-manifests.js @@ -53,14 +53,17 @@ async function cacheAssetManifests(db) { // Hacky for sure! const escapedManifest = JSON.stringify(JSON.stringify(manifest)); console.log( - `UPDATE swf_assets SET manifest = ${escapedManifest} ` + + `UPDATE swf_assets SET manifest = ${escapedManifest}, ` + + `manifest_cached_at = CURRENT_TIMESTAMP() ` + `WHERE id = ${row.id} LIMIT 1;` ); } else { const [ result, ] = await db.execute( - `UPDATE swf_assets SET manifest = ? WHERE id = ? LIMIT 1;`, + `UPDATE swf_assets SET manifest = ?, ` + + `manifest_cached_at = CURRENT_TIMESTAMP() ` + + `WHERE id = ? LIMIT 1;`, [manifest, row.id] ); if (result.affectedRows !== 1) {