1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2025-01-09 03:13:57 +09:00

サーバーサイドレートリミットを解除

This commit is contained in:
kakkokari-gtyih 2024-02-02 20:33:04 +09:00
parent 66a7a9e9d1
commit 869391261f

View File

@ -613,13 +613,6 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
if (!game.isStarted || game.isEnded) return; if (!game.isStarted || game.isEnded) return;
if ((game.user1Id !== user.id) && (game.user2Id !== user.id)) return; if ((game.user1Id !== user.id) && (game.user2Id !== user.id)) return;
const lastReactedAt = await this.redisClient.get(`reversi:game:lastReactedAt:${game.id}:${user.id}`);
if (lastReactedAt && (Date.now() - parseInt(lastReactedAt, 10) < 3000)) {
// レートリミット3秒
return;
}
let _reaction = '❤️'; let _reaction = '❤️';
const custom = reaction.match(isCustomEmojiRegexp); const custom = reaction.match(isCustomEmojiRegexp);
@ -639,8 +632,6 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
userId: user.id, userId: user.id,
reaction: _reaction, reaction: _reaction,
}); });
this.redisClient.setex(`reversi:game:lastReactedAt:${game.id}:${user.id}`, 60 * 60, Date.now().toString());
} }
@bindThis @bindThis