forked from cnpm/cnpmjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
28 lines (24 loc) · 867 Bytes
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
var graceful = require('graceful');
var registry = require('./servers/registry');
var web = require('./servers/web');
var logger = require('./common/logger');
var config = require('./config');
registry.listen(config.registryPort, config.bindingHost);
web.listen(config.webPort, config.bindingHost);
console.log('[%s] [worker:%d] Server started, registry server listen at %s:%d, web listen at %s:%d, cluster: %s',
new Date(), process.pid,
config.bindingHost, config.registryPort,
config.bindingHost, config.webPort,
config.enableCluster);
graceful({
server: [registry, web],
error: function (err, throwErrorCount) {
if (err.message) {
err.message += ' (uncaughtException throw ' + throwErrorCount + ' times on pid:' + process.pid + ')';
}
console.error(err);
console.error(err.stack);
logger.error(err);
}
});