MCPcopy
hub / github.com/thinkjs/thinkjs / _getMasterInstance

Method _getMasterInstance

lib/application.js:105–124  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

103 return options;
104 }
105 _getMasterInstance(argv) {
106 const port = argv.port || think.config('port');
107 const host = think.config('host');
108 const instance = new thinkCluster.Master({
109 port,
110 host,
111 sticky: think.config('stickyCluster'),
112 getRemoteAddress: socket => {
113 return socket.remoteAddress || '';
114 },
115 workers: think.config('workers'),
116 reloadSignal: think.config('reloadSignal')
117 });
118 this.masterInstance = instance;
119 think.logger.info(`Server running at http://${host || '127.0.0.1'}:${port}`);
120 think.logger.info(`ThinkJS version: ${think.version}`);
121 think.logger.info(`Environment: ${think.app.env}`);
122 think.logger.info(`Workers: ${instance.options.workers}`);
123 return instance;
124 }
125 /**
126 * run in master
127 */

Callers 1

runInMasterMethod · 0.95

Calls 2

configMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected