Commit | Line | Data |
---|---|---|
1 | import { KillBehaviors, ThreadWorker } from '../../../lib/index.js' | |
2 | import { sleepTaskFunction } from '../../test-utils.js' | |
3 | ||
4 | /** | |
5 | * | |
6 | * @param data | |
7 | * @returns | |
8 | */ | |
9 | async function error (data) { | |
10 | return sleepTaskFunction( | |
11 | data, | |
12 | 2000, | |
13 | true, | |
14 | 'Error Message from ThreadWorker:async' | |
15 | ) | |
16 | } | |
17 | ||
18 | export default new ThreadWorker(error, { | |
19 | killBehavior: KillBehaviors.HARD, | |
20 | maxInactiveTime: 500 | |
21 | }) |