Skip to content

Commit

Permalink
[FIX] node v17.5.0 seems to go in a loop, suspect some internal patch…
Browse files Browse the repository at this point in the history
…ing of subarray to slice, which the lib was already doing as Node's slice performed copies. Removing the optimization, which means that in older node environments, additional memory may be used.

FIX nats-io/nats.js#483
  • Loading branch information
aricart committed Feb 14, 2022
1 parent 0e47433 commit e09ecdd
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions nats-base-client/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ export class Parser {
}

parse(buf: Uint8Array): void {
// @ts-ignore: on node.js module is a global
if (typeof module !== "undefined" && module.exports) {
// Uint8Array.slice() copies in node it doesn't and it is faster
buf.subarray = buf.slice;
}

let i: number;
for (i = 0; i < buf.length; i++) {
const b = buf[i];
Expand Down

0 comments on commit e09ecdd

Please sign in to comment.