Releases: Janlaywss/priority-worker-runner
Releases · Janlaywss/priority-worker-runner
0.1.0
🥳 feat: add cleanup effect api, Used to clean up the side effects of running tasks
const runner = new TaskRunner<Task>(({task}) => {
let timeRef: TimeRef = {value: undefined};
const cleanup = () => {
clearTimeout(timeRef.value);
}
const handle = async () => {
const event = task.event;
if (event === 'timeout') {
return await timeoutTask(timeRef);
}
}
return {handle, cleanup}
}, {
concurrentExecuteTaskMax: 5,
timeout: 5,
});