Use smaller batches for receipts and syncs

This commit is contained in:
Fedor Indutny 2021-07-29 18:08:04 -07:00 committed by GitHub
parent 8775c711ae
commit 03874a788f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 21 deletions

View file

@ -36,6 +36,8 @@ import { SignalService as Proto } from '../protobuf';
const THIRTY_SECONDS = 30 * 1000;
const MAX_MESSAGE_SIZE = 64 * 1024;
export class IncomingWebSocketRequest {
private readonly id: Long | number;
@ -207,6 +209,10 @@ export default class WebSocketResource extends EventTarget {
});
});
strictAssert(
bytes.length <= MAX_MESSAGE_SIZE,
'WebSocket request byte size exceeded'
);
this.socket.sendBytes(Buffer.from(bytes));
return promise;
@ -291,6 +297,10 @@ export default class WebSocketResource extends EventTarget {
(bytes: Buffer): void => {
this.removeActive(incomingRequest);
strictAssert(
bytes.length <= MAX_MESSAGE_SIZE,
'WebSocket response byte size exceeded'
);
this.socket.sendBytes(bytes);
}
);