Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow worker listen different port to support nginx sticky #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

killagu
Copy link
Contributor

@killagu killagu commented Jul 23, 2019

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@codecov
Copy link

codecov bot commented Jul 23, 2019

Codecov Report

Merging #94 into master will decrease coverage by 0.35%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
- Coverage   98.81%   98.46%   -0.36%     
==========================================
  Files           8        8              
  Lines         507      520      +13     
==========================================
+ Hits          501      512      +11     
- Misses          6        8       +2
Impacted Files Coverage Δ
lib/app_worker.js 100% <100%> (ø) ⬆️
lib/master.js 98.52% <100%> (-0.02%) ⬇️
lib/utils/options.js 94.59% <0%> (-2.71%) ⬇️
lib/utils/messenger.js 98.07% <0%> (-1.93%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6b6102...7127c43. Read the comment docs.

this[WORKER_ADDRESSES].push(address);
} else {
address.port = this.options.sticky ? this[REAL_PORT] : address.port;
this[APP_ADDRESS] = getAddress(address);
}
Copy link
Member

Choose a reason for hiding this comment

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

Why delete isUnixSock checking?

to: 'master',
from: 'app',
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

send port to master after egg ready and before server listen.

port,
protocol,
},
});
Copy link
Member

Choose a reason for hiding this comment

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

Why delete this one?

const stickyMsg = this.options.sticky ? ' with STICKY MODE!' : '';
this.logger.info('[master] %s started on %s (%sms)%s',
frameworkPkg.name, this[APP_ADDRESS], Date.now() - startTime, stickyMsg);
}

Copy link
Member

Choose a reason for hiding this comment

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

What's the different between nginxSticky and sticky? Seems they are mixed together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • nginxSticky: nginx -> app-worker
  • sticky: nginx -> master -> app-worker

@killagu
Copy link
Contributor Author

killagu commented Jul 26, 2019

@ngot Use ready callback to confirm worker is ready, instead of check listening port. When use nginxSticky mode, workers listen different port, check port will not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants