From 32dd0474f24e3a7b79d6a9275b9da0a87be0329b Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 12 Oct 2022 11:55:29 -0700 Subject: [PATCH] Better logging output for model-needed-items Print out the image hash for easier debugging (can look up the custom data ourselves to check it), and also fix a bug with retries not carrying `contextString` through, oops! --- scripts/model-needed-items.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/model-needed-items.js b/scripts/model-needed-items.js index 585d36b..b886694 100644 --- a/scripts/model-needed-items.js +++ b/scripts/model-needed-items.js @@ -91,8 +91,9 @@ async function main() { async function modelItems(items, context) { for (const item of items) { for (const species of item.speciesThatNeedModels) { + let imageHash; try { - await modelItem(item, species, context); + imageHash = await modelItem(item, species, context); } catch (error) { console.error( `❌ [${item.name} (${item.id}) on ${species.name} (${species.id}))] ` + @@ -103,7 +104,7 @@ async function modelItems(items, context) { } console.info( `✅ [${item.name} (${item.id}) on ${species.name} (${species.id}))] ` + - `Modeling data saved!` + `Modeling data saved! Hash: ${imageHash}` ); } } @@ -143,6 +144,8 @@ async function modelItem(item, species, context) { // Finally, model this data into the database! await saveModelingData(customPetData, petMetaData, context); + + return imageHash; } async function loadImageHash(item, species) { @@ -181,6 +184,7 @@ async function loadWithRetries(fn, { numAttempts, delay, contextString }) { return await loadWithRetries(fn, { numAttempts: numAttempts - 1, delay: delay * 2, + contextString, }); } }