Skip to content

Commit

Permalink
fix: auto increase port number (#830)
Browse files Browse the repository at this point in the history
* fix: auto increase port number

* bump
  • Loading branch information
qiweiii authored Sep 30, 2024
1 parent 9680b7c commit ac102d4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion executor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@acala-network/chopsticks-executor",
"description": "Chopsticks executor",
"version": "0.16.0",
"version": "0.16.1",
"license": "Apache-2.0",
"type": "module",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks",
"version": "0.16.0",
"version": "0.16.1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"bin": "./chopsticks.cjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/chopsticks/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const respond = (res: http.ServerResponse, data?: any) => {
res.end()
}

const portInUse = async (port: number) => {
const portInUse = async (port: number, addr: string) => {
const server = http.createServer()
const inUse = await new Promise<boolean>((resolve) => {
server.once('error', (e: any) => {
Expand All @@ -71,7 +71,7 @@ const portInUse = async (port: number) => {
server.close()
resolve(false)
})
server.listen(port)
server.listen(port, addr)
})
server.removeAllListeners()
server.unref()
Expand Down Expand Up @@ -151,7 +151,7 @@ export const createServer = async (handler: Handler, addr: string, port: number)
})

for (let i = 0; i < 10; i++) {
if (port && (await portInUse(port + i))) {
if (port && (await portInUse(port + i, addr))) {
continue
}
const preferPort = port ? port + i : undefined
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-core",
"version": "0.16.0",
"version": "0.16.1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-db",
"version": "0.16.0",
"version": "0.16.1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-testing",
"version": "0.16.0",
"version": "0.16.1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-utils",
"version": "0.16.0",
"version": "0.16.1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
Expand Down

0 comments on commit ac102d4

Please sign in to comment.