Show More
@@ -82,26 +82,39 b' require([' | |||||
82 |
|
82 | |||
83 | var interval_id=0; |
|
83 | var interval_id=0; | |
84 | // auto refresh every xx secondes, no need to be fast, |
|
84 | // auto refresh every xx secondes, no need to be fast, | |
85 |
// update is done |
|
85 | // update is done most of the time when page get focus | |
86 |
|
|
86 | IPython.tree_time_refresh = 60; // in sec | |
87 |
|
87 | |||
88 | var enable_autorefresh = function(){ |
|
88 | // limit refresh on focus at 1/10sec, otherwise this | |
89 | /** |
|
89 | // can cause too frequent refresh on switching through windows or tabs. | |
90 | *refresh immediately , then start interval |
|
90 | IPython.min_delta_refresh = 10; // in sec | |
91 | */ |
|
91 | ||
|
92 | var _last_refresh = null; | |||
|
93 | ||||
|
94 | var _refresh_list = function(){ | |||
|
95 | _last_refresh = new Date(); | |||
92 | session_list.load_sessions(); |
|
96 | session_list.load_sessions(); | |
93 | cluster_list.load_list(); |
|
97 | cluster_list.load_list(); | |
94 | if (terminal_list) { |
|
98 | if (terminal_list) { | |
95 | terminal_list.load_terminals(); |
|
99 | terminal_list.load_terminals(); | |
96 | } |
|
100 | } | |
|
101 | } | |||
|
102 | ||||
|
103 | var enable_autorefresh = function(){ | |||
|
104 | /** | |||
|
105 | *refresh immediately , then start interval | |||
|
106 | */ | |||
|
107 | var now = new Date() | |||
|
108 | ||||
|
109 | if (now - _last_refresh < IPython.min_delta_refresh*1000){ | |||
|
110 | console.log("Reenabling autorefresh too close to last tree refresh, not refreshing immediately again.") | |||
|
111 | } else { | |||
|
112 | _refresh_list(); | |||
|
113 | } | |||
97 | if (!interval_id){ |
|
114 | if (!interval_id){ | |
98 |
interval_id = setInterval( |
|
115 | interval_id = setInterval(_refresh_list, | |
99 | session_list.load_sessions(); |
|
116 | IPython.tree_time_refresh*1000 | |
100 | cluster_list.load_list(); |
|
117 | ); | |
101 | if (terminal_list) { |
|
|||
102 | terminal_list.load_terminals(); |
|
|||
103 | } |
|
|||
104 | }, time_refresh*1000); |
|
|||
105 | } |
|
118 | } | |
106 | }; |
|
119 | }; | |
107 |
|
120 |
General Comments 0
You need to be logged in to leave comments.
Login now