Oops, fix db pooling for scripts

Right, ok, `db.close()` needs to be `db.end()` now.

This probably didn't break the user-syncing cron job though, because that doesn't automatically update I think? so it should still be comfortably running older version of the code that should still work just fine
This commit is contained in:
Emi Matchu 2022-02-03 16:14:40 -08:00
parent 3744a476e5
commit c1eef6222b
2 changed files with 4 additions and 4 deletions

View file

@ -52,7 +52,7 @@ async function cacheAssetManifests(db) {
// Make it a JSON string, then escape the string for the query.
// Hacky for sure!
const escapedManifest = JSON.stringify(JSON.stringify(manifest));
console.log(
console.info(
`UPDATE swf_assets SET manifest = ${escapedManifest}, ` +
`manifest_cached_at = CURRENT_TIMESTAMP() ` +
`WHERE id = ${row.id} LIMIT 1;`
@ -115,10 +115,10 @@ async function main() {
try {
await cacheAssetManifests(db);
} catch (e) {
db.close();
db.end();
throw e;
}
db.close();
db.end();
}
main().catch((e) => {

View file

@ -71,7 +71,7 @@ async function main() {
);
users = rows.map(normalizeRow);
} finally {
db.close();
db.end();
}
let i = 0;