Skip to content
Snippets Groups Projects
Commit 908e0f3b authored by syuilo's avatar syuilo
Browse files

perf(reversi): set expire matchSpecific and matchAny

parent b68446b2
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,10 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
}
//#endregion
this.redisClient.zadd(`reversi:matchSpecific:${targetUser.id}`, Date.now(), me.id);
const redisPipeline = this.redisClient.pipeline();
redisPipeline.zadd(`reversi:matchSpecific:${targetUser.id}`, Date.now(), me.id);
redisPipeline.expire(`reversi:matchSpecific:${targetUser.id}`, 120, 'NX');
redisPipeline.exec();
this.globalEventService.publishReversiStream(targetUser.id, 'invited', {
user: await this.userEntityService.pack(me, targetUser),
......@@ -186,7 +189,10 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
return game;
} else {
await this.redisClient.zadd('reversi:matchAny', Date.now(), me.id);
const redisPipeline = this.redisClient.pipeline();
redisPipeline.zadd('reversi:matchAny', Date.now(), me.id);
redisPipeline.expire('reversi:matchAny', 120, 'NX');
await redisPipeline.exec();
return null;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment