Skip to content

Commit

Permalink
perf(client): Await timeouts only in recursive connects
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Dec 10, 2020
1 parent 6a8cd37 commit 55c8fc8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ export function createClient(options: ClientOptions): Client {
}

// if recursive call, wait a bit for socket change
await new Promise((resolve) => setTimeout(resolve, callDepth * 50));
if (callDepth) {
await new Promise((resolve) => setTimeout(resolve, callDepth * 50));
}

// socket already exists. can be ready or pending, check and behave accordingly
if (state.socket) {
Expand Down

0 comments on commit 55c8fc8

Please sign in to comment.