mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 03:43:07 +02:00
perf(reversi): set expire matchSpecific and matchAny
This commit is contained in:
parent
b68446b289
commit
908e0f3b8b
1 changed files with 8 additions and 2 deletions
|
@ -125,7 +125,10 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||||
}
|
}
|
||||||
//#endregion
|
//#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', {
|
this.globalEventService.publishReversiStream(targetUser.id, 'invited', {
|
||||||
user: await this.userEntityService.pack(me, targetUser),
|
user: await this.userEntityService.pack(me, targetUser),
|
||||||
|
@ -186,7 +189,10 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||||
|
|
||||||
return game;
|
return game;
|
||||||
} else {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue