mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-21 21:45:11 +00:00
merge: make the cap of activeRateLimitRequests
match the rate limit (!602)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/602 Approved-by: Julia Johannesen <julia@insertdomain.name> Approved-by: Amelia Yukii <amelia.yukii@shourai.de> Approved-by: Marie <2-Marie@users.noreply.activitypub.software>
This commit is contained in:
commit
2e2dcb6b8d
2 changed files with 4 additions and 2 deletions
|
@ -151,7 +151,7 @@ export class StreamingApiServerService {
|
|||
return this.rateLimitThis(user, requestIp, {
|
||||
key: 'wsmessage',
|
||||
duration: ms('2sec'),
|
||||
max: 4090,
|
||||
max: 4096,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -120,7 +120,9 @@ export default class Connection {
|
|||
if (this.closingConnection) return;
|
||||
|
||||
if (this.rateLimiter) {
|
||||
if (this.activeRateLimitRequests <= 128) {
|
||||
// this 4096 should match the `max` of the `rateLimiter`, see
|
||||
// StreamingApiServerService
|
||||
if (this.activeRateLimitRequests <= 4096) {
|
||||
this.activeRateLimitRequests++;
|
||||
const shouldRateLimit = await this.rateLimiter();
|
||||
this.activeRateLimitRequests--;
|
||||
|
|
Loading…
Reference in a new issue