aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jco...@apache.org
Subject aurora git commit: Only process instances if there's been a change.
Date Wed, 02 Sep 2015 18:16:12 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 64c00f105 -> d6b2c7e33


Only process instances if there's been a change.

The `true` parameter to `scope.$watch` tells Angular to only execute the supplied function
if the watched data has changed. Given our 15s polling interval is likely less than time it
takes for any progress to be made on an update, this removes the majority of (no-op) DOM operations.

Testing Done:
Left tab open continually polling a job with ~3000 instances, confirmed that memory usage
did not grow beyond ~200MB.

Bugs closed: AURORA-1345

Reviewed at https://reviews.apache.org/r/37956/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/d6b2c7e3
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/d6b2c7e3
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/d6b2c7e3

Branch: refs/heads/master
Commit: d6b2c7e33c3d7eed8fb4c223e5412f03cf3f3312
Parents: 64c00f1
Author: Joshua Cohen <jcohen@apache.org>
Authored: Wed Sep 2 13:15:48 2015 -0500
Committer: Joshua Cohen <jcohen@apache.org>
Committed: Wed Sep 2 13:15:48 2015 -0500

----------------------------------------------------------------------
 src/main/resources/scheduler/assets/js/directives.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/d6b2c7e3/src/main/resources/scheduler/assets/js/directives.js
----------------------------------------------------------------------
diff --git a/src/main/resources/scheduler/assets/js/directives.js b/src/main/resources/scheduler/assets/js/directives.js
index c02c26f..ef94ade 100644
--- a/src/main/resources/scheduler/assets/js/directives.js
+++ b/src/main/resources/scheduler/assets/js/directives.js
@@ -165,17 +165,18 @@
       },
       link: function (scope, element, attrs) {
         scope.$watch('instances', function () {
-          var parent = angular.element('<div></div>');
           if (!scope.instances || scope.instances.length === 0) {
             return;
           }
+
           var cssClasses = [ 'instance-grid', scope.size ];
           var aborted = scope.status === JobUpdateStatus.ABORTED;
           if (aborted) {
             cssClasses.push(ABORTED.toLowerCase());
           }
 
-          var list = angular.element('<ul class="' + cssClasses.join(' ') + '"></ul>');
+          var parent = angular.element('<div></div>');
+          var list = angular.element('<ul class="instance-grid ' + scope.size + '"></ul>');
 
           scope.instances.forEach(function (i) {
             var n = i.instanceId;
@@ -199,7 +200,7 @@
           parent.append(list);
           element.html(parent.html());
           $compile(element)(scope);
-        });
+        }, true);
       }
     };
   });


Mime
View raw message