1
1
import { ACTOR_CHEERIO_CHECKER_NAME , ACTOR_PLAYWRIGHT_CHECKER_NAME , ACTOR_PUPPETEER_CHECKER_NAME } from './constants.js' ;
2
2
import type { PreparedActorConfig , ActorInputData , CreateActorRunConfig } from './typedefs.js' ;
3
3
4
- export function convertInputToActorConfigs ( input : ActorInputData ) {
4
+ export function convertInputToActorConfigs ( input : ActorInputData ) : PreparedActorConfig [ ] {
5
5
const configs : PreparedActorConfig [ ] = [ ] ;
6
6
7
7
for ( const urlData of input . urlsToCheck ) {
8
8
if ( input [ 'checkers.cheerio' ] ) {
9
9
configs . push ( ...createActorRunConfigForCrawler ( { input, urlData, checkerId : ACTOR_CHEERIO_CHECKER_NAME } ) ) ;
10
10
}
11
11
if ( input [ 'checkers.puppeteer' ] ) {
12
- configs . push ( ...createActorRunConfigForCrawler ( { input, urlData, checkerId : ACTOR_PUPPETEER_CHECKER_NAME } ) ) ;
12
+ configs . push ( ...createActorRunConfigForCrawler ( { input, urlData, checkerId : ACTOR_PUPPETEER_CHECKER_NAME , memory : input [ 'puppeteer.memory' ] } ) ) ;
13
13
}
14
14
if ( input [ 'checkers.playwright' ] ) {
15
15
// Create a run config for each playwright browser
@@ -19,6 +19,7 @@ export function convertInputToActorConfigs(input: ActorInputData) {
19
19
urlData,
20
20
checkerId : ACTOR_PLAYWRIGHT_CHECKER_NAME ,
21
21
playwrightBrowser : 'chrome' ,
22
+ memory : input [ 'playwright.memory' ] ,
22
23
} ) ) ;
23
24
}
24
25
if ( input [ 'playwright.firefox' ] ) {
@@ -27,6 +28,7 @@ export function convertInputToActorConfigs(input: ActorInputData) {
27
28
urlData,
28
29
checkerId : ACTOR_PLAYWRIGHT_CHECKER_NAME ,
29
30
playwrightBrowser : 'firefox' ,
31
+ memory : input [ 'playwright.memory' ] ,
30
32
} ) ) ;
31
33
}
32
34
if ( input [ 'playwright.webkit' ] ) {
@@ -35,6 +37,7 @@ export function convertInputToActorConfigs(input: ActorInputData) {
35
37
urlData,
36
38
checkerId : ACTOR_PLAYWRIGHT_CHECKER_NAME ,
37
39
playwrightBrowser : 'webkit' ,
40
+ memory : input [ 'playwright.memory' ] ,
38
41
} ) ) ;
39
42
}
40
43
}
@@ -43,7 +46,7 @@ export function convertInputToActorConfigs(input: ActorInputData) {
43
46
return configs ;
44
47
}
45
48
46
- function * createActorRunConfigForCrawler ( { input, urlData, checkerId, playwrightBrowser } : CreateActorRunConfig ) {
49
+ function * createActorRunConfigForCrawler ( { input, urlData, checkerId, playwrightBrowser, memory } : CreateActorRunConfig ) {
47
50
for ( const group of input . proxyConfiguration . apifyProxyGroups ?? [ 'auto' ] ) {
48
51
const config : PreparedActorConfig = {
49
52
actorId : checkerId ,
@@ -67,7 +70,7 @@ function* createActorRunConfigForCrawler({ input, urlData, checkerId, playwright
67
70
navigationTimeoutSecs : input . navigationTimeoutSecs ,
68
71
} ,
69
72
params : {
70
- memory : checkerId === ACTOR_CHEERIO_CHECKER_NAME ? 4096 : 8192 ,
73
+ memory : memory || ( checkerId === ACTOR_CHEERIO_CHECKER_NAME ? 4096 : 8192 ) ,
71
74
timeout : 24 * 3600 ,
72
75
} ,
73
76
} ;
0 commit comments