Commit 942c0586 authored by 李尚科's avatar 李尚科

fix

parent e09e4d94
Pipeline #12309 passed with stage
in 20 seconds
......@@ -23,10 +23,12 @@ class HuaYunPaas extends Subscription {
//用redis的setnx来实现锁机制
let lock = 'huayun:pass:cron:' + moment().format('MMDD');
ctx.logger.info(lock);
ctx.logger.info(JSON.stringify(await app.redis.get(lock)));
let redRes = await app.redis.setnx(lock, 1);
ctx.logger.info(JSON.stringify(redRes));
ctx.logger.info('in cron');
if (Number(redRes) === 1) {
await app.redis.expire(lock, 2);
ctx.logger.info('in redis');
await this.logic();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment