From c1eef6222b86d6975f5bc1400b4715b38dca7818 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 3 Feb 2022 16:14:40 -0800 Subject: [PATCH] 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 --- scripts/cache-asset-manifests.js | 6 +++--- scripts/export-users-to-auth0.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cache-asset-manifests.js b/scripts/cache-asset-manifests.js index aa3d616..f3435a0 100644 --- a/scripts/cache-asset-manifests.js +++ b/scripts/cache-asset-manifests.js @@ -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) => { diff --git a/scripts/export-users-to-auth0.js b/scripts/export-users-to-auth0.js index 5aed213..231a656 100644 --- a/scripts/export-users-to-auth0.js +++ b/scripts/export-users-to-auth0.js @@ -71,7 +71,7 @@ async function main() { ); users = rows.map(normalizeRow); } finally { - db.close(); + db.end(); } let i = 0;