|
|
|
@ -27,9 +27,10 @@ let judgeQueue;
|
|
|
|
|
async function connect() { |
|
|
|
|
const JudgeState = syzoj.model('judge_state'); |
|
|
|
|
|
|
|
|
|
const blockableRedisClient = syzoj.redis.duplicate(); |
|
|
|
|
judgeQueue = { |
|
|
|
|
redisZADD: util.promisify(syzoj.redis.zadd).bind(syzoj.redis), |
|
|
|
|
redisBZPOPMAX: util.promisify(syzoj.redis.bzpopmax).bind(syzoj.redis), |
|
|
|
|
redisBZPOPMAX: util.promisify(blockableRedisClient.bzpopmax).bind(blockableRedisClient), |
|
|
|
|
async push(data, priority) { |
|
|
|
|
return await this.redisZADD('judge', priority, JSON.stringify(data)); |
|
|
|
|
}, |
|
|
|
|