limit memory consumption

This commit is contained in:
Mentor 2022-08-22 14:28:29 +02:00
parent 3e7948b831
commit 39b91946eb
2 changed files with 30 additions and 30 deletions

View File

@ -5,7 +5,7 @@ const mainnetAPI = require( './endpoints/mainnet' )
// Runtime config // Runtime config
const runtime = { const runtime = {
timeoutSeconds: 540, timeoutSeconds: 540,
memory: '4GB' memory: '512MB'
} }
// Testnet endpoint // Testnet endpoint

View File

@ -76,50 +76,50 @@ export default function Verifier() {
} }
async function generateNewOutfit( ) { // async function generateNewOutfit( ) {
try { // try {
log( `Generating new outfit for #${ rocketeerId }` ) // log( `Generating new outfit for #${ rocketeerId }` )
setLoading( `Generating new outfit for #${ rocketeerId }` ) // setLoading( `Generating new outfit for #${ rocketeerId }` )
alert( 'You will be prompted to sign a message, this is NOT a transaction' ) // alert( 'You will be prompted to sign a message, this is NOT a transaction' )
const signature = await sign( JSON.stringify( { // const signature = await sign( JSON.stringify( {
signer: address.toLowerCase(), // signer: address.toLowerCase(),
rocketeerId, // rocketeerId,
chainId, // chainId,
} ), address ) // } ), address )
log( 'Making request with ', signature ) // log( 'Making request with ', signature )
setLoading( 'Generating new outfit, this can take a minute' ) // setLoading( 'Generating new outfit, this can take a minute' )
const { error, success } = await callApi( `/rocketeer/${ rocketeerId }/outfits`, { // const { error, success } = await callApi( `/rocketeer/${ rocketeerId }/outfits`, {
method: 'POST', // method: 'POST',
headers: { 'Content-Type': 'application/json' }, // headers: { 'Content-Type': 'application/json' },
body: JSON.stringify( signature ) // body: JSON.stringify( signature )
} ) // } )
if( error ) throw new Error( error ) // if( error ) throw new Error( error )
alert( `Success! Outfit generated.` ) // alert( `Success! Outfit generated.` )
window?.location.reload() // window?.location.reload()
} catch( e ) { // } catch( e ) {
log( e ) // log( e )
alert( e.message ) // alert( e.message )
} finally { // } finally {
setLoading( false ) // setLoading( false )
} // }
} // }
async function generateByAddress( ) { async function generateByAddress() {
try { try {
@ -230,7 +230,7 @@ export default function Verifier() {
<Section direction="column" gutter={ true }> <Section direction="column" gutter={ true }>
<H2>{ rocketeer.name }</H2> <H2>{ rocketeer.name }</H2>
<Avatar key={ rocketeer.id } src={ rocketeer.image } alt={ `Rocketeer number ${ rocketeer.id }` } /> <Avatar key={ rocketeer.id } src={ rocketeer.image } alt={ `Rocketeer number ${ rocketeer.id }` } />
{ rocketeer.new_outfit_available ? <Button onClick={ generateNewOutfit }>Generate new outfit</Button> : <Text align="center">New outfit available on { rocketeer.when_new_outfit.toString() }</Text> } { rocketeer.new_outfit_available ? <Button onClick={ generateByAddress }>Generate new outfit</Button> : <Text align="center">New outfit available on { rocketeer.when_new_outfit.toString() }</Text> }
</Section> </Section>