Commit | Line | Data |
---|---|---|
1 | 'use strict' | |
2 | const { ThreadWorker, KillBehaviors } = require('../../../lib/index') | |
3 | ||
4 | async function error (data) { | |
5 | return new Promise((resolve, reject) => { | |
6 | setTimeout(() => reject(new Error(data)), 2000) | |
7 | }) | |
8 | } | |
9 | ||
10 | module.exports = new ThreadWorker(error, { | |
11 | maxInactiveTime: 500, | |
12 | async: true, | |
13 | killBehavior: KillBehaviors.HARD | |
14 | }) |