Repository: ambari Updated Branches: refs/heads/trunk 7452077a3 -> 97bf29a35
AMBARI-11812 Perf cluster: Prevent make a call for service metric when it's already called. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/97bf29a3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/97bf29a3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/97bf29a3 Branch: refs/heads/trunk Commit: 97bf29a3533623422a1d3c8e746e73e54f122924 Parents: 7452077 Author: Andrii Tkach <atk...@hortonworks.com> Authored: Tue Jun 9 16:58:58 2015 +0300 Committer: Andrii Tkach <atk...@hortonworks.com> Committed: Tue Jun 9 18:38:08 2015 +0300 ---------------------------------------------------------------------- .../app/controllers/global/update_controller.js | 26 +++++++++++++++----- ambari-web/app/routes/main.js | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/97bf29a3/ambari-web/app/controllers/global/update_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js index af7b69e..7246c37 100644 --- a/ambari-web/app/controllers/global/update_controller.js +++ b/ambari-web/app/controllers/global/update_controller.js @@ -41,6 +41,14 @@ App.UpdateController = Em.Controller.extend({ paginationKeys: ['page_size', 'from'], + /** + * map which track status of requests, whether it's running or completed + * @type {object} + */ + requestsRunningStatus: { + "updateServiceMetric": false + }, + getUrl: function (testUrl, url) { return (App.get('testMode')) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url; }, @@ -362,6 +370,7 @@ App.UpdateController = Em.Controller.extend({ var isATSPresent = App.StackServiceComponent.find().findProperty('componentName','APP_TIMELINE_SERVER'); var conditionalFields = this.getConditionalFields(), + requestsRunningStatus = this.get('requestsRunningStatus'), conditionalFieldsString = conditionalFields.length > 0 ? ',' + conditionalFields.join(',') : '', testUrl = '/data/dashboard/HDP2/master_components.json', isFlumeInstalled = App.cache['services'].mapProperty('ServiceInfo.service_name').contains('FLUME'), @@ -405,12 +414,17 @@ App.UpdateController = Em.Controller.extend({ callback = callback || function () { self.set('isUpdated', true); }; - App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, { - complete: function () { - App.set('router.mainServiceItemController.isServicesInfoLoaded', App.get('router.clusterController.isLoaded')); - callback(); - } - }); + + if (!requestsRunningStatus["updateServiceMetric"]) { + requestsRunningStatus["updateServiceMetric"] = true; + App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, { + complete: function () { + App.set('router.mainServiceItemController.isServicesInfoLoaded', App.get('router.clusterController.isLoaded')); + callback(); + requestsRunningStatus["updateServiceMetric"] = false; + } + }); + } }, /** * construct conditional parameters of query, depending on which services are installed http://git-wip-us.apache.org/repos/asf/ambari/blob/97bf29a3/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 53482b6..78d8243 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -636,7 +636,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { route: '/summary', connectOutlets: function (router, context) { var item = router.get('mainServiceItemController.content'); - router.get('updateController').updateServiceMetric(Em.K); + if (router.get('clusterController.isLoaded')) router.get('updateController').updateServiceMetric(Em.K); //if service is not existed then route to default service if (item.get('isLoaded')) { router.get('mainServiceItemController').connectOutlet('mainServiceInfoSummary', item);