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!
This commit is contained in:
parent
d591eabd0a
commit
32dd0474f2
1 changed files with 6 additions and 2 deletions
|
@ -91,8 +91,9 @@ async function main() {
|
||||||
async function modelItems(items, context) {
|
async function modelItems(items, context) {
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
for (const species of item.speciesThatNeedModels) {
|
for (const species of item.speciesThatNeedModels) {
|
||||||
|
let imageHash;
|
||||||
try {
|
try {
|
||||||
await modelItem(item, species, context);
|
imageHash = await modelItem(item, species, context);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
`❌ [${item.name} (${item.id}) on ${species.name} (${species.id}))] ` +
|
`❌ [${item.name} (${item.id}) on ${species.name} (${species.id}))] ` +
|
||||||
|
@ -103,7 +104,7 @@ async function modelItems(items, context) {
|
||||||
}
|
}
|
||||||
console.info(
|
console.info(
|
||||||
`✅ [${item.name} (${item.id}) on ${species.name} (${species.id}))] ` +
|
`✅ [${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!
|
// Finally, model this data into the database!
|
||||||
await saveModelingData(customPetData, petMetaData, context);
|
await saveModelingData(customPetData, petMetaData, context);
|
||||||
|
|
||||||
|
return imageHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadImageHash(item, species) {
|
async function loadImageHash(item, species) {
|
||||||
|
@ -181,6 +184,7 @@ async function loadWithRetries(fn, { numAttempts, delay, contextString }) {
|
||||||
return await loadWithRetries(fn, {
|
return await loadWithRetries(fn, {
|
||||||
numAttempts: numAttempts - 1,
|
numAttempts: numAttempts - 1,
|
||||||
delay: delay * 2,
|
delay: delay * 2,
|
||||||
|
contextString,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue