build.webkit.org/dashboard: Poor performance when there are broken builds at initial...
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Aug 2014 06:58:51 +0000 (06:58 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Aug 2014 06:58:51 +0000 (06:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136281

Reviewed by Tim Horton.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
Track and expose whether the itertion is being loaded. Made update() a no-op if
the iteration is already being loaded.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:
(BuildbotBuilderQueueView.prototype.update.appendBuilderQueueStatus): Instead of
loading everything at once, ask the queue to load a little more. We can always repeat
if we still don't have enough data.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
(BuildbotQueue.prototype.loadMoreHistoricalIterations): Added a function that loads
10 more iterations intelligently.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172998 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js
Tools/ChangeLog

index aaa35cb..5a5047c 100644 (file)
@@ -108,9 +108,7 @@ BuildbotBuilderQueueView.prototype = {
 
                 if (firstRecentUnsuccessfulIteration) {
                     // We have a failed iteration but no successful. It might be further back in time.
-                    // Update all the iterations so we get more history.
-                    // FIXME: It can be very time consuming to load all iterations, we should load progressively.
-                    queue.iterations.forEach(function(iteration) { iteration.update(); });
+                    queue.loadMoreHistoricalIterations();
                 }
             }
         }
index e5ca5ea..30dee5e 100644 (file)
@@ -40,6 +40,7 @@ BuildbotIteration = function(queue, dataOrID, finished)
     this.id = dataOrID;
 
     this.loaded = false;
+    this.isLoading = false;
 
     this.openSourceRevision = null;
     this.internalRevision = null;
@@ -295,7 +296,13 @@ BuildbotIteration.prototype = {
         if (this.queue.buildbot.needsAuthentication && this.queue.buildbot.authenticationStatus === Buildbot.AuthenticationStatus.InvalidCredentials)
             return;
 
+        if (this.isLoading)
+            return;
+
+        this.isLoading = true;
+
         JSON.load(this.queue.baseURL + "/builds/" + this.id, function(data) {
+            this.isLoading = false;
             this.queue.buildbot.isAuthenticated = true;
             if (!data || !data.properties)
                 return;
@@ -303,6 +310,7 @@ BuildbotIteration.prototype = {
             this._updateWithData(data);
         }.bind(this),
         function(data) {
+            this.isLoading = false;
             if (data.errorType === JSON.LoadError && data.errorHTTPCode === 401) {
                 this.queue.buildbot.isAuthenticated = false;
                 this.dispatchEventToListeners(BuildbotIteration.Event.UnauthorizedAccess);
index efbbf75..20d36c0 100644 (file)
@@ -152,6 +152,32 @@ BuildbotQueue.prototype = {
         );
     },
 
+    loadMoreHistoricalIterations: function()
+    {
+        var indexOfFirstNewlyLoadingIteration;
+        for (var i = 0; i < this.iterations.length; ++i) {
+            if (indexOfFirstNewlyLoadingIteration !== undefined && i >= indexOfFirstNewlyLoadingIteration + BuildbotQueue.RecentIterationsToLoad)
+                return;
+            var iteration = this.iterations[i];
+            if (!iteration.finished)
+                continue;
+            if (iteration.isLoading) {
+                // Caller lacks visibility into loading, so it is likely to call this function too often.
+                // Give it a chance to analyze everything that's been already requested first, and then it can decide whether it needs more.
+                return;
+            }
+            if (iteration.loaded && indexOfFirstNewlyLoadingIteration !== undefined) {
+                // There was a gap between loaded iterations, which we've closed now.
+                return;
+            }
+            if (!iteration.loaded) {
+                if (indexOfFirstNewlyLoadingIteration === undefined)
+                    indexOfFirstNewlyLoadingIteration = i;
+                iteration.update();
+            }
+        }
+    },
+
     update: function()
     {
         this._load(this.baseURL, function(data) {
index 236673c..917f2d7 100644 (file)
@@ -1,5 +1,25 @@
 2014-08-26  Alexey Proskuryakov  <ap@apple.com>
 
+        build.webkit.org/dashboard: Poor performance when there are broken builds at initial load time
+        https://bugs.webkit.org/show_bug.cgi?id=136281
+
+        Reviewed by Tim Horton.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
+        Track and expose whether the itertion is being loaded. Made update() a no-op if
+        the iteration is already being loaded.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:
+        (BuildbotBuilderQueueView.prototype.update.appendBuilderQueueStatus): Instead of
+        loading everything at once, ask the queue to load a little more. We can always repeat
+        if we still don't have enough data.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
+        (BuildbotQueue.prototype.loadMoreHistoricalIterations): Added a function that loads
+        10 more iterations intelligently.
+
+2014-08-26  Alexey Proskuryakov  <ap@apple.com>
+
         build.webkit.org/dashboard raises an exception when Trac RSS fails to load
         https://bugs.webkit.org/show_bug.cgi?id=136283