Skip to content

Commit

Permalink
drop the cache element when websocket is closed.
Browse files Browse the repository at this point in the history
Change-Id: I2cee74d3b5db4d2f3c30a3a0211147991944d3fb
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
  • Loading branch information
benoitf committed Feb 22, 2017
1 parent 576860d commit 2fe99bc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dashboard/src/components/api/che-websocket.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ export class CheWebsocket {
if (!this.bus) {
// needs to initialize
this.bus = new MessageBus(this.$websocket(this.wsBaseUrl), this.$interval);
this.bus.onClose(
() => {
// remove it from the cache so new calls will create a new instance
this.bus.closed = true;
this.bus = null;
}
)
}
return this.bus;
}
Expand All @@ -81,6 +88,13 @@ export class CheWebsocket {
if (!this.remoteBus) {
// needs to initialize
this.remoteBus = new MessageBus(this.$websocket(websocketURL), this.$interval);
this.remoteBus.onClose(
() => {
// remove it from the cache so new calls will create a new instance
this.remoteBus.closed = true;
this.remoteBus = null;
}
)
}
return this.remoteBus;
}
Expand Down

0 comments on commit 2fe99bc

Please sign in to comment.