|
|
@ -6,7 +6,7 @@ import util = require('util'); |
|
|
|
import rmq = require('./rmq'); |
|
|
|
import rmq = require('./rmq'); |
|
|
|
import remote = require('./remote'); |
|
|
|
import remote = require('./remote'); |
|
|
|
import { judge } from './judge'; |
|
|
|
import { judge } from './judge'; |
|
|
|
import { JudgeResult, ErrorType, ProgressReportType, OverallResult } from '../interfaces'; |
|
|
|
import { JudgeResult, ErrorType, ProgressReportType, OverallResult, SerializedBuffer } from '../interfaces'; |
|
|
|
|
|
|
|
|
|
|
|
(async function () { |
|
|
|
(async function () { |
|
|
|
winston.info("Daemon starts."); |
|
|
|
winston.info("Daemon starts."); |
|
|
@ -14,6 +14,11 @@ import { JudgeResult, ErrorType, ProgressReportType, OverallResult } from '../in |
|
|
|
await rmq.connect(); |
|
|
|
await rmq.connect(); |
|
|
|
winston.info("Start consuming the queue."); |
|
|
|
winston.info("Start consuming the queue."); |
|
|
|
await remote.waitForTask(async (task) => { |
|
|
|
await remote.waitForTask(async (task) => { |
|
|
|
|
|
|
|
if (task.extraData) { |
|
|
|
|
|
|
|
const extraData: SerializedBuffer = task.extraData as any as SerializedBuffer; |
|
|
|
|
|
|
|
if (extraData.type === "Buffer") task.extraData = new Buffer(extraData.data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let result: OverallResult; |
|
|
|
let result: OverallResult; |
|
|
|
try { |
|
|
|
try { |
|
|
|
await remote.reportProgress({ taskId: task.content.taskId, type: ProgressReportType.Started, progress: null }); |
|
|
|
await remote.reportProgress({ taskId: task.content.taskId, type: ProgressReportType.Started, progress: null }); |
|
|
|