Spaces:
Build error
Build error
fix: search with failed pages
Browse files
backend/functions/src/cloud-functions/crawler.ts
CHANGED
|
@@ -1036,14 +1036,18 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`;
|
|
| 1036 |
let concluded = false;
|
| 1037 |
|
| 1038 |
const handler = async (it: AsyncGenerator<PageSnapshot | undefined>, idx: number) => {
|
| 1039 |
-
|
| 1040 |
-
|
|
|
|
| 1041 |
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
|
|
|
|
|
|
|
|
|
|
| 1047 |
}
|
| 1048 |
};
|
| 1049 |
|
|
|
|
| 1036 |
let concluded = false;
|
| 1037 |
|
| 1038 |
const handler = async (it: AsyncGenerator<PageSnapshot | undefined>, idx: number) => {
|
| 1039 |
+
try {
|
| 1040 |
+
for await (const x of it) {
|
| 1041 |
+
results[idx] = x;
|
| 1042 |
|
| 1043 |
+
if (x) {
|
| 1044 |
+
nextDeferred.resolve();
|
| 1045 |
+
nextDeferred = Defer();
|
| 1046 |
+
}
|
| 1047 |
|
| 1048 |
+
}
|
| 1049 |
+
} catch (err: any) {
|
| 1050 |
+
this.logger.warn(`Failed to scrap ${urls[idx]}`, { err: marshalErrorLike(err) });
|
| 1051 |
}
|
| 1052 |
};
|
| 1053 |
|