Skip to content

Commit 5dcf55e

Browse files
authored
fix: connections not released when change stream (#1931)
Signed-off-by: Carson Cook <carson.cook@ibm.com>
1 parent 6a4fe36 commit 5dcf55e

File tree

1 file changed

+8
-1
lines changed
  • metrics-service-ui/frontend/public/hystrix-dashboard/monitor

1 file changed

+8
-1
lines changed

metrics-service-ui/frontend/public/hystrix-dashboard/monitor/monitor.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function getUrlVars() {
2020
}
2121

2222
var hystrixStreams = [];
23+
// CHANGE: make source a global variable so it can be closed when set a new stream
24+
var source = null; // EventSource that holds SSE connection
2325

2426
function addStreams(proxyStream, title) {
2527
// CHANGE: rely on function parameters instead of parsing window.location.href
@@ -72,8 +74,13 @@ function addStreams(proxyStream, title) {
7274

7375
// CHANGE: removed proxyStream variable declaration in favour of function parameter
7476

77+
// CHANGE: make source a global variable so it can be closed when set a new stream
78+
if (source !== null ) {
79+
source.close();
80+
}
7581
// start the EventSource which will open a streaming connection to the server
76-
var source = new EventSource(proxyStream);
82+
source = new EventSource(proxyStream);
83+
// END OF CHANGE
7784

7885
// add the listener that will process incoming events
7986
// CHANGE: add filter for adding listener so listener is only added for streams that match the selected stream to display

0 commit comments

Comments
 (0)