Limit number of rate limit requests

This commit is contained in:
Julia Johannesen 2024-08-16 17:13:20 -04:00
parent 4cd44130e0
commit 6d3f9503ed
No known key found for this signature in database
GPG key ID: 4A1377AF3E7FBC46
2 changed files with 29 additions and 2 deletions

View file

@ -26,12 +26,15 @@ import proxyAddr from 'proxy-addr';
import ms from 'ms';
import type * as http from 'node:http';
import type { IEndpointMeta } from './endpoints.js';
import { LoggerService } from '@/core/LoggerService.js';
import type Logger from '@/logger.js';
@Injectable()
export class StreamingApiServerService {
#wss: WebSocket.WebSocketServer;
#connections = new Map<WebSocket.WebSocket, number>();
#cleanConnectionsIntervalId: NodeJS.Timeout | null = null;
#logger: Logger;
constructor(
@Inject(DI.redisForSub)
@ -49,6 +52,7 @@ export class StreamingApiServerService {
private channelFollowingService: ChannelFollowingService,
private rateLimiterService: RateLimiterService,
private roleService: RoleService,
private loggerService: LoggerService,
) {
}
@ -155,6 +159,7 @@ export class StreamingApiServerService {
this.notificationService,
this.cacheService,
this.channelFollowingService,
this.loggerService,
user, app,
rateLimiter,
);