Skip to content

Commit e5fbd27

Browse files
authored
Fix timer interval issue (#128)
- When switching between subscription page and another page multiple times, multiple timers will be created resulting in multiple calls to the back end.
1 parent 0f11663 commit e5fbd27

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/resources/static/js/subscription.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var table;
44
var frontendServiceUrl;
55
var defaultFormKeyValuePair = { "formkey": "", "formvalue": "" };
66
var defaultFormKeyValuePairAuth = { "formkey": "Authorization", "formvalue": "" };
7+
var timerInterval;
78

89
jQuery(document).ready(function () {
910

@@ -87,7 +88,9 @@ jQuery(document).ready(function () {
8788
}
8889

8990
// Check if EI Backend Server is online every X seconds
90-
window.setInterval(function () { checkBackendStatus(); }, 15000);
91+
if (timerInterval == null){
92+
timerInterval = window.setInterval(function () { checkBackendStatus(); }, 15000);
93+
}
9194

9295
// Check if buttons should be enabled or disabled
9396
// Toggle warning text on and off

0 commit comments

Comments
 (0)