@@ -26,9 +26,15 @@ import { resetConnectedInstance as resetRdiConnectedInstance } from 'uiSrc/slice
26
26
import { loadPluginsAction } from 'uiSrc/slices/app/plugins'
27
27
import { appConnectivityError } from 'uiSrc/slices/app/connectivity'
28
28
import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
29
+ import { getConfig } from 'uiSrc/config'
29
30
import InstancePageRouter from './InstancePageRouter'
30
31
import InstanceConnectionLost from './instanceConnectionLost'
31
32
33
+ const riConfig = getConfig ( )
34
+
35
+ const { shouldGetRecommendations,
36
+ defaultTimeoutToGetRecommendations } = riConfig . database
37
+
32
38
export interface Props {
33
39
routes : any [ ]
34
40
}
@@ -58,6 +64,13 @@ const InstancePage = ({ routes = [] }: Props) => {
58
64
dispatch ( getDatabaseConfigInfoAction ( connectionInstanceId ) )
59
65
dispatch ( fetchConnectedInstanceInfoAction ( connectionInstanceId ) )
60
66
dispatch ( fetchRecommendationsAction ( connectionInstanceId ) )
67
+ let intervalId : ReturnType < typeof setInterval >
68
+
69
+ if ( shouldGetRecommendations ) {
70
+ intervalId = setInterval ( ( ) => {
71
+ dispatch ( fetchRecommendationsAction ( connectionInstanceId ) )
72
+ } , defaultTimeoutToGetRecommendations )
73
+ }
61
74
62
75
if ( contextInstanceId && contextInstanceId !== connectionInstanceId ) {
63
76
// rerender children only if the same page from scratch to clear all component states
@@ -73,6 +86,10 @@ const InstancePage = ({ routes = [] }: Props) => {
73
86
74
87
// clear rdi connection
75
88
dispatch ( resetRdiConnectedInstance ( ) )
89
+
90
+ return ( ) => {
91
+ intervalId && clearInterval ( intervalId )
92
+ }
76
93
} , [ connectionInstanceId ] )
77
94
78
95
useEffect ( ( ) => {
0 commit comments