Skip to content

Commit

Permalink
fix(core): handle multiple messages (#17199)
Browse files Browse the repository at this point in the history
  • Loading branch information
wSedlacek authored May 24, 2023
1 parent c9ec7d0 commit c57f7b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/nx/src/utils/consume-messages-from-socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ export function consumeMessagesFromSocket(callback: (message: string) => void) {
const chunk = data.toString();
if (chunk.codePointAt(chunk.length - 1) === 4) {
message += chunk.substring(0, chunk.length - 1);
callback(message);

// Server may send multiple messages in one chunk, so splitting by 0x4
const messages = message.split('');
for (const splitMessage of messages) {
callback(splitMessage);
}

message = '';
} else {
message += chunk;
Expand Down

1 comment on commit c57f7b8

@vercel
Copy link

@vercel vercel bot commented on c57f7b8 May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.