FIX: in some cases we subscribed to an invalid channel

in some very rare cases we would publish and empty payload causing
messagebus corruption

this broke all navigation
This commit is contained in:
Sam 2018-04-30 12:13:55 +10:00
parent f0bdca87d8
commit 8b62b59b2e
1 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,9 @@ export default Ember.Component.extend({
if (this.get('isDestroyed')) { return; } if (this.get('isDestroyed')) { return; }
this.set('presenceUsers', r.users); this.set('presenceUsers', r.users);
this.set('channel', r.messagebus_channel); this.set('channel', r.messagebus_channel);
if (!r.messagebus_channel) { return; }
this.messageBus.subscribe(r.messagebus_channel, message => { this.messageBus.subscribe(r.messagebus_channel, message => {
if (!this.get('isDestroyed')) this.set('presenceUsers', message.users); if (!this.get('isDestroyed')) this.set('presenceUsers', message.users);
this._clearTimer = Ember.run.debounce(this, 'clear', keepAliveDuration + bufferTime); this._clearTimer = Ember.run.debounce(this, 'clear', keepAliveDuration + bufferTime);