Pass sock
in recursive acceptJob
calls (#65)
This commit is contained in:
parent
bd486f5c04
commit
d25639c0ec
1 changed files with 2 additions and 2 deletions
|
@ -32,14 +32,14 @@ const acceptJob = async (uuid, sock) => {
|
||||||
}, sock);
|
}, sock);
|
||||||
jobAmount--;
|
jobAmount--;
|
||||||
if (queue.length > 0) {
|
if (queue.length > 0) {
|
||||||
acceptJob(queue[0]);
|
acceptJob(queue[0], sock);
|
||||||
}
|
}
|
||||||
log(`Job ${uuid} has finished`);
|
log(`Job ${uuid} has finished`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Error on job ${uuid}:`, err);
|
console.error(`Error on job ${uuid}:`, err);
|
||||||
jobAmount--;
|
jobAmount--;
|
||||||
if (queue.length > 0) {
|
if (queue.length > 0) {
|
||||||
acceptJob(queue[0]);
|
acceptJob(queue[0], sock);
|
||||||
}
|
}
|
||||||
delete jobs[uuid];
|
delete jobs[uuid];
|
||||||
sock.write(Buffer.concat([Buffer.from([0x2]), Buffer.from(uuid), Buffer.from(err.toString())]));
|
sock.write(Buffer.concat([Buffer.from([0x2]), Buffer.from(uuid), Buffer.from(err.toString())]));
|
||||||
|
|
Loading…
Reference in a new issue