Skip to content

Commit cf776aa

Browse files
committed
fix start address
1 parent 0d61836 commit cf776aa

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eggjs/cluster",
3-
"version": "3.0.0-beta.3",
3+
"version": "3.0.0-beta.4",
44
"publishConfig": {
55
"access": "public"
66
},

src/master.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class Master extends ReadyEventEmitter {
7979
this.startByProcess();
8080
}
8181

82-
this.log(`[master] =================== ${frameworkPkg.name} start =====================`);
82+
this.log(`[master] =================== ${frameworkPkg.name} start 🥚🥚🥚🥚 =====================`);
8383
this.logger.info(`[master] node version ${process.version}`);
8484
/* istanbul ignore next */
8585
if ('alinode' in process) {
@@ -153,7 +153,7 @@ export class Master extends ReadyEventEmitter {
153153
// get the real port from options and app.config
154154
// app worker will send after loading
155155
this.on('realport', ({ port, protocol }) => {
156-
this.logger.info('[master] got realport: %s, protocol: %s', port, protocol);
156+
// this.logger.info('[master] got realport: %s, protocol: %s', port, protocol);
157157
if (port) {
158158
this.#realPort = port;
159159
}
@@ -455,7 +455,7 @@ export class Master extends ReadyEventEmitter {
455455
address: ListeningAddress;
456456
}) {
457457
const worker = this.workerManager.getWorker(data.workerId)!;
458-
this.log('[master] got app_worker#%s:%s app-start event, data: %j', worker.id, worker.workerId, data);
458+
// this.log('[master] got app_worker#%s:%s app-start event, data: %j', worker.id, worker.workerId, data);
459459

460460
const address = data.address;
461461
// worker should listen stickyWorkerPort when sticky mode
@@ -637,14 +637,17 @@ function getAddress({
637637
return address!;
638638
}
639639

640-
let hostname = address;
641-
if (!hostname && process.env.HOST && process.env.HOST !== '0.0.0.0') {
642-
hostname = process.env.HOST;
640+
// {"address":"::","family":"IPv6","port":17001}
641+
if (address === '::') {
642+
address = '';
643643
}
644-
if (!hostname) {
645-
hostname = '127.0.0.1';
644+
if (!address && process.env.HOST && process.env.HOST !== '0.0.0.0') {
645+
address = process.env.HOST;
646646
}
647-
return `${protocol}://${hostname}:${port}`;
647+
if (!address) {
648+
address = '127.0.0.1';
649+
}
650+
return `${protocol}://${address}:${port}`;
648651
}
649652

650653
function isUnixSock(address: ListeningAddress) {

0 commit comments

Comments
 (0)