summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2024-01-24 16:44:12 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2024-01-24 16:44:12 +0900
commit60156a40b2984c320eaf9ddb0c7704d1f8e40f93 (patch)
tree59215829d623e833925336ed7799f5fa9d58e215 /packages
parentenhance(reversi): 変則なしマッチングを可能に (diff)
downloadsharkey-60156a40b2984c320eaf9ddb0c7704d1f8e40f93.tar.gz
sharkey-60156a40b2984c320eaf9ddb0c7704d1f8e40f93.tar.bz2
sharkey-60156a40b2984c320eaf9ddb0c7704d1f8e40f93.zip
fix(reversi/backend): refactor and fixes
Diffstat (limited to 'packages')
-rw-r--r--packages/backend/src/core/ReversiService.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/backend/src/core/ReversiService.ts b/packages/backend/src/core/ReversiService.ts
index 84721b2217..186ec6d7b1 100644
--- a/packages/backend/src/core/ReversiService.ts
+++ b/packages/backend/src/core/ReversiService.ts
@@ -120,7 +120,9 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
if (invitations.includes(targetUser.id)) {
await this.redisClient.zrem(`reversi:matchSpecific:${me.id}`, targetUser.id);
- const game = await this.matched(targetUser.id, me.id);
+ const game = await this.matched(targetUser.id, me.id, {
+ noIrregularRules: false,
+ });
return game;
}
@@ -166,7 +168,9 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
const invitorId = invitations[Math.floor(Math.random() * invitations.length)];
await this.redisClient.zrem(`reversi:matchSpecific:${me.id}`, invitorId);
- const game = await this.matched(invitorId, me.id);
+ const game = await this.matched(invitorId, me.id, {
+ noIrregularRules: false,
+ });
return game;
}
@@ -214,10 +218,7 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
@bindThis
public async matchAnyUserCancel(user: MiUser) {
- const redisPipeline = this.redisClient.pipeline();
- redisPipeline.zrem('reversi:matchAny', user.id);
- redisPipeline.zrem('reversi:matchAny', user.id + ':noIrregularRules');
- await redisPipeline.exec();
+ await this.redisClient.zrem('reversi:matchAny', user.id, user.id + ':noIrregularRules');
}
@bindThis