Skip to content

Commit

Permalink
Merge pull request #219 from fospring/feat-issue-215/tearDown-sometimes
Browse files Browse the repository at this point in the history
feat-issue-215: increase randoness to decrease the rate of port colli…
  • Loading branch information
ailisp authored Sep 11, 2023
2 parents fcb029b + 20dcf50 commit 5509fac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/js/dist/server/server.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/js/dist/server/server.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/js/dist/server/server.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/js/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ async function sandboxStarted(port: number, timeout = 60_000): Promise<void> {
throw new Error(`Sandbox Server with port: ${port} failed to start after ${timeout}ms`);
}

// 5001-60000, increase the range of initialPort to decrease the possibility of port conflict
function initialPort(): number {
return Math.max(1024, Math.floor(Math.random() * 10_000));
return Math.max(5001, Math.floor(Math.random() * 60_000));
}

export class SandboxServer {
Expand Down

0 comments on commit 5509fac

Please sign in to comment.