Browse Source

Fix polling judge task blocking the global redis connection for randering cache

pull/6/head
Menci 6 years ago
parent
commit
970d7891d4
  1. 3
      libs/judger.js

3
libs/judger.js

@ -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));
},

Loading…
Cancel
Save