Spaces:
Build error
Build error
tweak: try alleviate oom killed issue
Browse files
backend/functions/src/cloud-functions/crawler.ts
CHANGED
|
@@ -130,11 +130,11 @@ export class CrawlerHost extends RPCHost {
|
|
| 130 |
})
|
| 131 |
@CloudHTTPv2({
|
| 132 |
runtime: {
|
| 133 |
-
memory: '
|
| 134 |
cpu: 4,
|
| 135 |
timeoutSeconds: 300,
|
| 136 |
-
concurrency:
|
| 137 |
-
maxInstances:
|
| 138 |
minInstances: 1,
|
| 139 |
},
|
| 140 |
tags: ['Crawler'],
|
|
|
|
| 130 |
})
|
| 131 |
@CloudHTTPv2({
|
| 132 |
runtime: {
|
| 133 |
+
memory: '4GiB',
|
| 134 |
cpu: 4,
|
| 135 |
timeoutSeconds: 300,
|
| 136 |
+
concurrency: 8,
|
| 137 |
+
maxInstances: 1250,
|
| 138 |
minInstances: 1,
|
| 139 |
},
|
| 140 |
tags: ['Crawler'],
|
backend/functions/src/services/puppeteer.ts
CHANGED
|
@@ -9,7 +9,7 @@ import puppeteer from 'puppeteer-extra';
|
|
| 9 |
|
| 10 |
import puppeteerBlockResources from 'puppeteer-extra-plugin-block-resources';
|
| 11 |
import puppeteerPageProxy from 'puppeteer-extra-plugin-page-proxy';
|
| 12 |
-
import { SecurityCompromiseError, ServiceCrashedError } from '../shared/lib/errors';
|
| 13 |
import { TimeoutError } from 'puppeteer';
|
| 14 |
import _ from 'lodash';
|
| 15 |
const tldExtract = require('tld-extract');
|
|
@@ -285,7 +285,13 @@ export class PuppeteerControl extends AsyncService {
|
|
| 285 |
await this.serviceReady();
|
| 286 |
const dedicatedContext = await this.browser.createBrowserContext();
|
| 287 |
const sn = this._sn++;
|
| 288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
const preparations = [];
|
| 290 |
|
| 291 |
// preparations.push(page.setUserAgent(`Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)`));
|
|
|
|
| 9 |
|
| 10 |
import puppeteerBlockResources from 'puppeteer-extra-plugin-block-resources';
|
| 11 |
import puppeteerPageProxy from 'puppeteer-extra-plugin-page-proxy';
|
| 12 |
+
import { SecurityCompromiseError, ServiceCrashedError, ServiceNodeResourceDrainError } from '../shared/lib/errors';
|
| 13 |
import { TimeoutError } from 'puppeteer';
|
| 14 |
import _ from 'lodash';
|
| 15 |
const tldExtract = require('tld-extract');
|
|
|
|
| 285 |
await this.serviceReady();
|
| 286 |
const dedicatedContext = await this.browser.createBrowserContext();
|
| 287 |
const sn = this._sn++;
|
| 288 |
+
let page
|
| 289 |
+
try {
|
| 290 |
+
page = await dedicatedContext.newPage();
|
| 291 |
+
} catch (err: any) {
|
| 292 |
+
this.logger.warn(`Failed to create page ${sn}`, { err: marshalErrorLike(err) });
|
| 293 |
+
throw new ServiceNodeResourceDrainError(`This specific worker node failed to open a new page, try again.`);
|
| 294 |
+
}
|
| 295 |
const preparations = [];
|
| 296 |
|
| 297 |
// preparations.push(page.setUserAgent(`Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)`));
|
thinapps-shared
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit 2ce99a95bff6ea07f48e3388e270b2126d752d0c
|