From f80ba6f02b0e70b55ba38cb0847cbeb35b08f473 Mon Sep 17 00:00:00 2001 From: Mentor Date: Mon, 22 Aug 2022 14:50:22 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20split=20runtimes=20into=20cheap=20a?= =?UTF-8?q?nd=20expensive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/functions/index.js b/functions/index.js index abff93c..02a5e61 100644 --- a/functions/index.js +++ b/functions/index.js @@ -3,26 +3,30 @@ const testnetAPI = require( './endpoints/testnet' ) const mainnetAPI = require( './endpoints/mainnet' ) // Runtime config -const runtime = { +const expensive_runtime = { + timeoutSeconds: 540, + memory: '4GB' +} +const cheap_runtime = { timeoutSeconds: 540, memory: '512MB' } // Testnet endpoint -exports.testnetMetadata = functions.runWith( runtime ).https.onRequest( testnetAPI ) +exports.testnetMetadata = functions.runWith( cheap_runtime ).https.onRequest( testnetAPI ) // Mainnet endpoint -exports.mainnetMetadata = functions.runWith( runtime ).https.onRequest( mainnetAPI ) +exports.mainnetMetadata = functions.runWith( cheap_runtime ).https.onRequest( mainnetAPI ) /* /////////////////////////////// // Firestore listeners // /////////////////////////////*/ const { handleQueuedRocketeerOutfit } = require( './nft-media/changing-room' ) -exports.mainnetGenerateOutfitsOnQueue = functions.runWith( runtime ).firestore.document( `mainnetQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit ) -exports.rinkebyGenerateOutfitsOnQueue = functions.runWith( runtime ).firestore.document( `rinkebyQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit ) +exports.mainnetGenerateOutfitsOnQueue = functions.runWith( expensive_runtime ).firestore.document( `mainnetQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit ) +exports.rinkebyGenerateOutfitsOnQueue = functions.runWith( expensive_runtime ).firestore.document( `rinkebyQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit ) /* /////////////////////////////// // Daemons // /////////////////////////////*/ const { notify_holders_of_changing_room_updates } = require( './integrations/changingroom' ) -exports.notify_holders_of_changing_room_updates = functions.runWith( runtime ).pubsub.schedule( '30 1 * * *' ).onRun( notify_holders_of_changing_room_updates ) \ No newline at end of file +exports.notify_holders_of_changing_room_updates = functions.runWith( cheap_runtime ).pubsub.schedule( '30 1 * * *' ).onRun( notify_holders_of_changing_room_updates ) \ No newline at end of file