Browse Source

HUE-7695 [assist] Limit prefetching of columns in the right assist to the first 10 tables

Johan Ahlen 8 years ago
parent
commit
89eea5f
1 changed files with 10 additions and 4 deletions
  1. 10 4
      desktop/core/src/desktop/templates/assist.mako

+ 10 - 4
desktop/core/src/desktop/templates/assist.mako

@@ -2471,16 +2471,22 @@ from desktop.views import _ko
 
 
         var loadEntriesTimeout = -1;
         var loadEntriesTimeout = -1;
         // This fetches the columns for each table synchronously with 2 second in between.
         // This fetches the columns for each table synchronously with 2 second in between.
-        var loadEntries = function () {
+        var loadEntries = function (currentCount) {
+          var count = currentCount || 0;
+          count++;
+          if (count > 10) {
+            return;
+          }
           window.clearTimeout(loadEntriesTimeout);
           window.clearTimeout(loadEntriesTimeout);
           if (self.activeTables().length === 1) {
           if (self.activeTables().length === 1) {
             self.activeTables()[0].open(true);
             self.activeTables()[0].open(true);
-          }
-          else {
+          } else {
             loadEntriesTimeout = window.setTimeout(function () {
             loadEntriesTimeout = window.setTimeout(function () {
               self.activeTables().every(function (table) {
               self.activeTables().every(function (table) {
                 if (!table.loaded && !table.hasErrors() && !table.loading()) {
                 if (!table.loaded && !table.hasErrors() && !table.loading()) {
-                  table.loadEntries(loadEntries, true);
+                  table.loadEntries(function () {
+                    loadEntries(count);
+                  }, true);
                   return false;
                   return false;
                 }
                 }
                 return !table.loading();
                 return !table.loading();