const executor = tasks.get(data.id)
if (executor == null) return
+ tasks.delete(data.id)
const [ok, err] = executor
const { result } = data
console.log('received result from worker')
if (typeof result !== 'boolean' && typeof result !== 'string' && !isBytes(result)) {
- err('Invalid return type')
+ return err('Invalid return type')
}
- ok(result)
+ return ok(result)
}
// Check that the worker is running and listening before sending messages