Skip to content

Commit

Permalink
[deno] normalized tcp buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed May 31, 2023
1 parent 12761ca commit 9548735
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/deno_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {

const VERSION = "1.15.0";
const LANG = "nats.deno";
const SOCKET_BUF = 128 * 1024;

// if trying to simply write to the connection for some reason
// messages are dropped - deno websocket implementation does this.
Expand Down Expand Up @@ -71,7 +72,7 @@ export class DenoTransport implements Transport {
}> = [];

constructor() {
this.buf = new Uint8Array(1024 * 8);
this.buf = new Uint8Array(SOCKET_BUF);
}

async connect(
Expand Down Expand Up @@ -172,7 +173,7 @@ export class DenoTransport implements Transport {

while (!this.done) {
try {
this.buf = new Uint8Array(64 * 1024);
this.buf = new Uint8Array(SOCKET_BUF);
const c = await this.conn.read(this.buf);
if (c === null) {
break;
Expand Down

0 comments on commit 9548735

Please sign in to comment.