Pass `sock` in recursive `acceptJob` calls (#65)

This commit is contained in:
adroitwhiz 2021-02-19 22:01:41 -05:00 committed by GitHub
parent bd486f5c04
commit d25639c0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -32,14 +32,14 @@ const acceptJob = async (uuid, sock) => {
}, sock);
jobAmount--;
if (queue.length > 0) {
acceptJob(queue[0]);
acceptJob(queue[0], sock);
}
log(`Job ${uuid} has finished`);
} catch (err) {
console.error(`Error on job ${uuid}:`, err);
jobAmount--;
if (queue.length > 0) {
acceptJob(queue[0]);
acceptJob(queue[0], sock);
}
delete jobs[uuid];
sock.write(Buffer.concat([Buffer.from([0x2]), Buffer.from(uuid), Buffer.from(err.toString())]));