From e3cc9793709c614e3e7267857845a9d7da5471ad Mon Sep 17 00:00:00 2001 From: Mentor Palokaj Date: Thu, 30 Dec 2021 11:08:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20make=20parallel=20generation=20m?= =?UTF-8?q?ore=20conservative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/nft-media/changing-room.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/nft-media/changing-room.js b/functions/nft-media/changing-room.js index c564519..518b8e0 100644 --- a/functions/nft-media/changing-room.js +++ b/functions/nft-media/changing-room.js @@ -125,10 +125,15 @@ async function generateNewOutfitsByAddress( address, network='mainnet' ) { const ids = await getTokenIdsOfAddress( address, network ) const queue = ids.map( id => function() { - return generateNewOutfitFromId( id, network ).then( outfit => ( { id: id, src: outfit } ) ).catch( e => ( { id: id, error: e.message } ) ) + return generateNewOutfitFromId( id, network ).then( outfit => ( { id: id, src: outfit } ) ).catch( e => { + console.error( `Error in generateNewOutfitsByAddress: `, e.message || e ) + return { id: id, error: e.message } + } ) } ) + const outfits = await Throttle.all( queue, { - maxInProgress: 2, + maxInProgress: 1, + failFast: false, progressCallback: ( { amountDone } ) => process.env.NODE_ENV == 'development' ? console.log( `Completed ${amountDone}/${queue.length}` ) : false } )