Skip to content

Commit

Permalink
fix: increase timeout and better error message (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 authored Oct 31, 2024
1 parent aaec8ca commit b088348
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/extractor/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import internalExtractor from './extractor.js';
import { loadModule } from '../utils/moduleLoader.js';
import { type Deferred, createDeferred } from '../utils/deferred.js';

const FILE_TIME_LIMIT = 60 * 1000; // one minute

export type WorkerParams = {
extractor?: string;
file: string;
Expand Down Expand Up @@ -81,8 +83,10 @@ function createWorker() {
currentDeferred = job[1];
timeout = setTimeout(() => {
worker.terminate();
currentDeferred.reject(new Error('aborted'));
}, 10e3);
currentDeferred.reject(
new Error(`Time limit for parsing ${job[0].file} exceeded`)
);
}, FILE_TIME_LIMIT);
}

worker.on('message', (msg) => {
Expand Down

0 comments on commit b088348

Please sign in to comment.