Fix bug causing channels to get stuck when DB is down

This commit is contained in:
Calvin Montgomery 2016-08-31 21:32:42 -07:00
parent ced2719f0e
commit 8b94c54d25
4 changed files with 21 additions and 2 deletions

View file

@ -90,6 +90,10 @@ function Channel(name) {
var self = this;
db.channels.load(this, function (err) {
if (err && err !== "Channel is not registered") {
self.emit("loadFail", "Failed to load channel data from the database");
// Force channel to be unloaded, so that it will load properly when
// the database connection comes back
self.emit("empty");
return;
} else {
self.initModules();