File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ type LoaderCommonConfig = {
91
91
}
92
92
93
93
type LoaderHasConfig = {
94
- timeout : number
94
+ timeout ? : number
95
95
maxRetry : number
96
96
priority : number
97
97
}
@@ -378,14 +378,14 @@ function loaderCommonConfigToCrawlConfig(
378
378
detail
379
379
380
380
// 1.1.baseUrl
381
- if ( ! isUndefined ( xCrawlConfig . baseUrl ) ) {
381
+ if ( xCrawlConfig . baseUrl ) {
382
382
detail . url = xCrawlConfig . baseUrl + url
383
383
}
384
384
385
385
// 1.2.timeout
386
386
if ( isUndefined ( timeout ) ) {
387
387
if ( ! isUndefined ( advancedDetailTargetsConfig . timeout ) ) {
388
- detail . timeout = advancedDetailTargetsConfig . timeout
388
+ detail . timeout = advancedDetailTargetsConfig . timeout ?? undefined
389
389
} else {
390
390
detail . timeout = xCrawlConfig . timeout
391
391
}
@@ -394,7 +394,7 @@ function loaderCommonConfigToCrawlConfig(
394
394
// 1.3.maxRetry
395
395
if ( isUndefined ( maxRetry ) ) {
396
396
if ( ! isUndefined ( advancedDetailTargetsConfig . maxRetry ) ) {
397
- detail . maxRetry = advancedDetailTargetsConfig . maxRetry
397
+ detail . maxRetry = advancedDetailTargetsConfig . maxRetry ?? 0
398
398
} else {
399
399
detail . maxRetry = xCrawlConfig . maxRetry
400
400
}
Original file line number Diff line number Diff line change @@ -69,13 +69,13 @@ export interface DetailTargetFingerprintCommon {
69
69
}
70
70
71
71
export interface CrawlCommonConfig {
72
- timeout ?: number
72
+ timeout ?: number | null
73
73
proxy ?: {
74
74
urls : string [ ]
75
75
switchByHttpStatus ?: number [ ]
76
76
switchByErrorCount ?: number
77
- }
78
- maxRetry ?: number
77
+ } | null
78
+ maxRetry ?: number | null
79
79
}
80
80
81
81
// 1.Detail target
@@ -140,7 +140,9 @@ export interface CrawlDataAdvancedConfig<T> extends CrawlCommonConfig {
140
140
141
141
headers ?: AnyObject
142
142
143
- onCrawlItemComplete ?: ( crawlDataSingleResult : CrawlDataSingleResult < T > ) => void
143
+ onCrawlItemComplete ?: (
144
+ crawlDataSingleResult : CrawlDataSingleResult < T >
145
+ ) => void
144
146
}
145
147
146
148
export interface CrawlFileAdvancedConfig extends CrawlCommonConfig {
You can’t perform that action at this time.
0 commit comments