Add --resync-existing to cache-asset-manifests

Wowie, looks like all the SVG asset manifests changed format lol! Running this now to update them all. There's a lot of them!
This commit is contained in:
Emi Matchu 2021-01-21 15:14:23 -08:00
parent 382aa1430e
commit 2164f06021
2 changed files with 11 additions and 1 deletions

View file

@ -16,9 +16,16 @@ const connectToDb = require("../src/server/db");
const neopetsAssets = require("../src/server/neopets-assets");
async function cacheAssetManifests(db) {
// Normally, we skip manifests that we already have. But you can run with
// --resync-existing to check old manifests for changes! (This might take,
// like, multiple minutes to even run this first query!)
const condition = argv.resyncExisting
? `1`
: `manifest IS NULL OR manifest = ""`;
const [rows] = await db.execute(
`SELECT id, url, manifest FROM swf_assets ` +
`WHERE manifest IS NULL OR manifest = "" AND id >= ? ` +
`WHERE ${condition} AND id >= ? ` +
`ORDER BY id`,
[argv.start || 0]
);

View file

@ -160,6 +160,9 @@ const resolvers = {
// In the `lod` case, if there's a JS asset, then don't treat this as an
// SVG asset at all. (There might be an SVG in the asset list anyway
// sometimes I think, for the animation, but ignore it if so!)
//
// NOTE: I thiiink the `vector` case is deprecated? I haven't verified
// whether it's gone from our database yet, though.
const jsAssetDatum = asset.assetData.find((ad) =>
ad.path.endsWith(".js")
);