Skip to content

Commit

Permalink
Merge 301d9cc into 3fb351b
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed Jun 15, 2014
2 parents 3fb351b + 301d9cc commit 56b8ae1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ store:
# domain: loggly-subdomain
file:
level: trace
path: /tmp/joola.io/
path: /var/log/joola.io
datastore:
mongodb:
dsn: mongodb://localhost:27017/cache
Expand Down
10 changes: 2 additions & 8 deletions lib/common/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,8 @@ if (process.env.NODE_ENV !== 'test') {
if (msg == 'shutdown') {
// Your process is going to be reloaded
// Close all database/socket.io/* connections
joola.logger.info('Closing all connections...');
setTimeout(function () {
joola.logger.info('Finished closing connections');
// You can exit to faster the process or it will be
// automatically killed after 4000ms.
// You can override the timeout by modifying PM2_GRACEFUL_TIMEOUT
process.exit(0);
}, 1500);
joola.logger.info('Recieved SHUTDOWN message, drain, close and restart...');
joola.shutdown('GRACEFUL');
}
});

Expand Down
11 changes: 8 additions & 3 deletions lib/common/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@ joola.silentShutdown = function (code, callback) {

joola.datastore.destroy(function () {
var node = joola.nodeState();
if (node.http) {
if (node.http || node.https) {
//We're running an http node, let's try to start another one.
joola.logger.debug('Trying to start Web Services on another node');
joola.dispatch.request(0, 'startWebServer', [node], function () {
//do we care?
});

joola.webserver.stop(callback);
}

joola.redis.del('nodes:' + joola.UID, function (err) {
//do we care?
});

if (typeof callback === 'function')
return callback(null);
if (!node.http && !node.https) {
if (typeof callback === 'function')
return callback(null);
}
return;
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/common/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ joola.events.once('config:done', function () {
})
};
logger.addStream(s);
console.log(s);
joola.logger.info('Added loggly stream for domain [' + loggly.domain + '], with level [' + (loggly.level || 'info') + '].');
}

//verify we have a valid path to log file
Expand Down
18 changes: 10 additions & 8 deletions lib/webserver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,17 @@ webserver.stop = function (callback) {
sockets[i].destroy();
}

if (self.http) {
self.http.close();
}
if (self.https) {
self.https.close();
}
setTimeout(function () {
if (self.http) {
self.http.close();
}
if (self.https) {
self.https.close();
}

if (typeof callback === 'function')
callback(null);
if (typeof callback === 'function')
callback(null);
}, 500);
};

webserver.verify = function (callback) {
Expand Down

0 comments on commit 56b8ae1

Please sign in to comment.