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