increase memory limit

This commit is contained in:
Harsh Gupta 2024-08-14 16:59:51 +05:30
parent b682ee5bb5
commit 1d8b3eae0d

View File

@ -1,7 +1,7 @@
import 'reflect-metadata'; import 'reflect-metadata';
import { initializeApp } from 'firebase-admin/app'; import { initializeApp } from 'firebase-admin/app';
import { CrawlerHost } from './cloud-functions/crawler'; import { CrawlerHost } from './cloud-functions/crawler';
import { https, HttpsFunction } from 'firebase-functions'; import { runWith, https, HttpsFunction } from 'firebase-functions';
import { Logger } from './shared/logger'; import { Logger } from './shared/logger';
import { container } from 'tsyringe'; import { container } from 'tsyringe';
import { PuppeteerControl } from './services/puppeteer'; import { PuppeteerControl } from './services/puppeteer';
@ -19,25 +19,17 @@ container.registerSingleton(AsyncContext);
container.registerSingleton(CrawlerHost); container.registerSingleton(CrawlerHost);
const crawlerHost = container.resolve(CrawlerHost); const crawlerHost = container.resolve(CrawlerHost);
export const crawler = https.onRequest(async (req, res) => { export const crawler = runWith({
memory: '4GB',
timeoutSeconds: 540,
}).https.onRequest(async (req, res) => {
await crawlerHost.crawl(req, res); await crawlerHost.crawl(req, res);
}); });
export const helloWorld: HttpsFunction = https.onRequest((req, res) => { export const helloWorld: HttpsFunction = https.onRequest((req, res) => {
res.send('Hello World!'); res.send('Hello World!');
}); });
// import { loadModulesDynamically, registry } from './shared';
// import path from 'path';
// loadModulesDynamically(path.resolve(__dirname, 'cloud-functions'));
// Object.assign(exports, registry.exportAll());
// Object.assign(exports, registry.exportGrouped({
// memory: '4GiB',
// timeoutSeconds: 540,
// }));
// registry.allHandsOnDeck().catch(() => void 0);
// registry.title = 'reader';
// registry.version = '0.1.0';
process.on('unhandledRejection', (reason, promise) => { process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason); console.error('Unhandled Rejection at:', promise, 'reason:', reason);