|
|
@ -59,7 +59,7 @@ async function connect() { |
|
|
|
ack(); |
|
|
|
ack(); |
|
|
|
|
|
|
|
|
|
|
|
if (waitingForTask) { |
|
|
|
if (waitingForTask) { |
|
|
|
winston.verbose(`Judge client ${socket.id} emitted waitForTask, but already waiting, ignoring.`); |
|
|
|
winston.warn(`Judge client ${socket.id} emitted waitForTask, but already waiting, ignoring.`); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -74,14 +74,14 @@ async function connect() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!obj) { |
|
|
|
if (!obj) { |
|
|
|
winston.verbose(`Judge client ${socket.id} disconnected, stop poll the queue.`); |
|
|
|
winston.warn(`Judge client ${socket.id} disconnected, stop poll the queue.`); |
|
|
|
// Socket disconnected and no task got.
|
|
|
|
// Socket disconnected and no task got.
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Re-push to queue if got task but judge client already disconnected.
|
|
|
|
// Re-push to queue if got task but judge client already disconnected.
|
|
|
|
if (socket.disconnected) { |
|
|
|
if (socket.disconnected) { |
|
|
|
winston.verbose(`Judge client ${socket.id} got task but disconnected re-pushing task to queue.`); |
|
|
|
winston.warn(`Judge client ${socket.id} got task but disconnected re-pushing task to queue.`); |
|
|
|
judgeQueue.push(obj.data, obj.priority); |
|
|
|
judgeQueue.push(obj.data, obj.priority); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -99,7 +99,7 @@ async function connect() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
socket.on('disconnect', reason => { |
|
|
|
socket.on('disconnect', reason => { |
|
|
|
winston.info(`Judge client ${socket.id} disconnected, reason = ${util.inspect(reason)}.`); |
|
|
|
winston.warn(`Judge client ${socket.id} disconnected, reason = ${util.inspect(reason)}.`); |
|
|
|
if (pendingAckTaskObj) { |
|
|
|
if (pendingAckTaskObj) { |
|
|
|
// A task sent but not acked, push to queue again.
|
|
|
|
// A task sent but not acked, push to queue again.
|
|
|
|
winston.warn(`Re-pushing task ${pendingAckTaskObj.data.content.taskId} to judge queue.`); |
|
|
|
winston.warn(`Re-pushing task ${pendingAckTaskObj.data.content.taskId} to judge queue.`); |
|
|
|