split runtimes into cheap and expensive

This commit is contained in:
Mentor 2022-08-22 14:50:22 +02:00
parent 0069a5f2a3
commit f80ba6f02b

View File

@ -3,26 +3,30 @@ const testnetAPI = require( './endpoints/testnet' )
const mainnetAPI = require( './endpoints/mainnet' ) const mainnetAPI = require( './endpoints/mainnet' )
// Runtime config // Runtime config
const runtime = { const expensive_runtime = {
timeoutSeconds: 540,
memory: '4GB'
}
const cheap_runtime = {
timeoutSeconds: 540, timeoutSeconds: 540,
memory: '512MB' memory: '512MB'
} }
// Testnet endpoint // Testnet endpoint
exports.testnetMetadata = functions.runWith( runtime ).https.onRequest( testnetAPI ) exports.testnetMetadata = functions.runWith( cheap_runtime ).https.onRequest( testnetAPI )
// Mainnet endpoint // Mainnet endpoint
exports.mainnetMetadata = functions.runWith( runtime ).https.onRequest( mainnetAPI ) exports.mainnetMetadata = functions.runWith( cheap_runtime ).https.onRequest( mainnetAPI )
/* /////////////////////////////// /* ///////////////////////////////
// Firestore listeners // Firestore listeners
// /////////////////////////////*/ // /////////////////////////////*/
const { handleQueuedRocketeerOutfit } = require( './nft-media/changing-room' ) const { handleQueuedRocketeerOutfit } = require( './nft-media/changing-room' )
exports.mainnetGenerateOutfitsOnQueue = functions.runWith( runtime ).firestore.document( `mainnetQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit ) exports.mainnetGenerateOutfitsOnQueue = functions.runWith( expensive_runtime ).firestore.document( `mainnetQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit )
exports.rinkebyGenerateOutfitsOnQueue = functions.runWith( runtime ).firestore.document( `rinkebyQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit ) exports.rinkebyGenerateOutfitsOnQueue = functions.runWith( expensive_runtime ).firestore.document( `rinkebyQueueOutfitGeneration/{rocketeerId}` ).onWrite( handleQueuedRocketeerOutfit )
/* /////////////////////////////// /* ///////////////////////////////
// Daemons // Daemons
// /////////////////////////////*/ // /////////////////////////////*/
const { notify_holders_of_changing_room_updates } = require( './integrations/changingroom' ) 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 ) exports.notify_holders_of_changing_room_updates = functions.runWith( cheap_runtime ).pubsub.schedule( '30 1 * * *' ).onRun( notify_holders_of_changing_room_updates )