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!
This commit is contained in:
Emi Matchu 2021-03-11 02:23:40 -08:00
parent 46066807ad
commit cfbb23d9ff

View file

@ -53,14 +53,17 @@ async function cacheAssetManifests(db) {
// Hacky for sure! // Hacky for sure!
const escapedManifest = JSON.stringify(JSON.stringify(manifest)); const escapedManifest = JSON.stringify(JSON.stringify(manifest));
console.log( 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;` `WHERE id = ${row.id} LIMIT 1;`
); );
} else { } else {
const [ const [
result, result,
] = await db.execute( ] = 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] [manifest, row.id]
); );
if (result.affectedRows !== 1) { if (result.affectedRows !== 1) {