Offload tasks to a pool of workers on node.js and in the browser
Overall
score
95%
Build a task processing system that can handle worker crashes gracefully and continue processing remaining tasks without losing track of failures.
The system must create a worker pool that executes computational tasks in parallel workers.
@generates
The implementation should:
The worker script should be created at ./src/crash-worker.js and should:
/**
* Creates a resilient task processor that handles worker crashes
*
* @returns {Object} An object with methods to submit tasks and clean up
*/
function createResilientProcessor() {
// Returns object with:
// - submitTask(shouldCrash): Promise that resolves with result or rejects on crash
// - cleanup(): Promise that cleans up the worker pool
}
module.exports = { createResilientProcessor };Provides worker pool functionality with crash recovery capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-workerpoolevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10