Skip to content

Commit 66ffc0d

Browse files
committed
Update .gitignore to include FUTURE.md; enhance error handling in filters.ts to log errors instead of throwing; modify tempfile naming in task-helper.ts to use randomUUID for uniqueness.
1 parent 0961f9e commit 66ffc0d

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ profiles.json
4141
_todo_update/
4242
botasaurus/botasaurus_storage.json
4343
bota/src/bota/package_storage.json
44+
FUTURE.md

js/botasaurus-server-js/src/filters.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,13 @@ export function applyFiltersInPlace(
447447
for (const filterObj of applicableFilters) {
448448
if (!(filterObj.hasFilterValue(record))) {
449449
const rep = JSON.stringify(record, null, 4);
450-
throw new JsonHTTPResponseWithMessage(
450+
console.error(
451451
`Filter field ${filterObj.field} not found in data record: ${
452452
rep.length >= 1003 ? rep.slice(0, 1000) + '...' : rep
453-
}.`
453+
}.\nSkipping record.`
454454
);
455+
passesAllFilters = false;
456+
break;
455457
}
456458
if (!filterObj.filter(filtersData[filterObj.id], filterObj.getFilterValue(record))) {
457459
passesAllFilters = false;

js/botasaurus-server-js/src/task-helper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as fs from 'fs';
2+
import { randomUUID } from 'crypto';
23
import { isNotNullish, isNullish } from "./null-utils";
34
import { createTask, db, Task } from "./models";
45
import { TaskResults } from "./task-results";
@@ -159,7 +160,7 @@ async function writeDeduplicatedTasks(
159160
const shouldNormalizeFlag = shouldNormalize(allKeys, firstItemKeyCount)
160161
let needsRerun = false
161162

162-
const tempfile = taskFilePath + '.temp'
163+
const tempfile = taskFilePath + '.' + randomUUID() + '.temp'
163164
const ndjsonWriteStream = new NDJSONWriteStream(tempfile)
164165
const seen = new Set()
165166

0 commit comments

Comments
 (0)