mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 03:51:26 +01:00
webserver: only start listening _after_ everything is compiled
This commit is contained in:
5
app.js
5
app.js
@@ -160,11 +160,12 @@ function start() {
|
||||
require('./src/user').startJobs();
|
||||
}
|
||||
|
||||
webserver.listen();
|
||||
|
||||
async.waterfall([
|
||||
async.apply(meta.themes.setupPaths),
|
||||
async.apply(plugins.ready),
|
||||
async.apply(meta.templates.compile),
|
||||
async.apply(webserver.listen)
|
||||
async.apply(meta.templates.compile)
|
||||
], function(err) {
|
||||
if (err) {
|
||||
winston.error(err.stack);
|
||||
|
||||
@@ -138,7 +138,7 @@ if(nconf.get('ssl')) {
|
||||
|
||||
server.setTimout && server.setTimeout(10000);
|
||||
|
||||
module.exports.listen = function(callback) {
|
||||
module.exports.listen = function() {
|
||||
logger.init(app);
|
||||
|
||||
var isSocket = isNaN(port),
|
||||
@@ -149,15 +149,13 @@ if(nconf.get('ssl')) {
|
||||
args.push(function(err) {
|
||||
if (err) {
|
||||
winston.info('[startup] NodeBB was unable to listen on: ' + bind_address);
|
||||
return callback(err);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
winston.info('NodeBB is now listening on: ' + (isSocket ? port : bind_address));
|
||||
if (oldUmask) {
|
||||
process.umask(oldUmask);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
|
||||
// Alter umask if necessary
|
||||
@@ -166,7 +164,9 @@ if(nconf.get('ssl')) {
|
||||
net = require('net');
|
||||
module.exports.testSocket(port, function(err) {
|
||||
if (!err) {
|
||||
server.listen.apply(server, args);
|
||||
emitter.on('nodebb:ready', function() {
|
||||
server.listen.apply(server, args);
|
||||
});
|
||||
} else {
|
||||
winston.error('[startup] NodeBB was unable to secure domain socket access (' + port + ')');
|
||||
winston.error('[startup] ' + err.message);
|
||||
@@ -174,7 +174,9 @@ if(nconf.get('ssl')) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
server.listen.apply(server, args);
|
||||
emitter.on('nodebb:ready', function() {
|
||||
server.listen.apply(server, args);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user