mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 15:35:12 +00:00
relax websocket rate limits
* the frontend opens 2 websockets at startup (I'm not completely clear why), and that `minInterval:1sec` was breaking the second connection * as the comment says, "catching up" generates many noteSubscribe messages
This commit is contained in:
parent
38430f8ef3
commit
caa0fecdc9
1 changed files with 6 additions and 3 deletions
|
@ -100,7 +100,6 @@ export class StreamingApiServerService {
|
||||||
key: 'wsconnect',
|
key: 'wsconnect',
|
||||||
duration: ms('5min'),
|
duration: ms('5min'),
|
||||||
max: 32,
|
max: 32,
|
||||||
minInterval: ms('1sec'),
|
|
||||||
})) {
|
})) {
|
||||||
socket.write('HTTP/1.1 429 Rate Limit Exceeded\r\n\r\n');
|
socket.write('HTTP/1.1 429 Rate Limit Exceeded\r\n\r\n');
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
@ -145,10 +144,14 @@ export class StreamingApiServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
const rateLimiter = () => {
|
const rateLimiter = () => {
|
||||||
|
// rather high limit, because when catching up at the top of a
|
||||||
|
// timeline, the frontend may render many many notes, each of
|
||||||
|
// which causes a message via `useNoteCapture` to ask for
|
||||||
|
// realtime updates of that note
|
||||||
return this.rateLimitThis(user, requestIp, {
|
return this.rateLimitThis(user, requestIp, {
|
||||||
key: 'wsmessage',
|
key: 'wsmessage',
|
||||||
duration: ms('5sec'),
|
duration: ms('2sec'),
|
||||||
max: 256,
|
max: 4090,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue