cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [27/50] [abbrv] git commit: refs/heads/ui-plugins - CLOUDSTACK-618: cloudstack UI - API request throttling - for async job action, make frequency of calling queryAsyncJobResult API based on listCapabilities response.
Date Wed, 13 Feb 2013 22:04:21 GMT
CLOUDSTACK-618: cloudstack UI - API request throttling - for async job action, make frequency
of calling queryAsyncJobResult API based on listCapabilities response.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/06a733a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/06a733a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/06a733a8

Branch: refs/heads/ui-plugins
Commit: 06a733a89fe67ea700505c5efccbe16c1ed6d7a0
Parents: 4869f0c
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Tue Feb 12 15:50:58 2013 -0800
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Tue Feb 12 16:00:48 2013 -0800

----------------------------------------------------------------------
 ui/scripts/cloudStack.js               |   16 +++++++++++++++-
 ui/scripts/sharedFunctions.js          |    1 +
 ui/scripts/ui/widgets/notifications.js |    4 ++--
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06a733a8/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index fab6f7d..6981366 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -157,6 +157,13 @@
 			
             g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
 						
+            if(json.listcapabilitiesresponse.capability.apilimitinterval != null &&
json.listcapabilitiesresponse.capability.apilimitmax != null) {						
+							var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval *
1000) / json.listcapabilitiesresponse.capability.apilimitmax ) * 3; //multiply 3 to be on
safe side
+							//intervalLimit = 9999; //this line is for testing only, comment it before check in
+							if(intervalLimit > g_queryAsyncJobResultInterval)
+								g_queryAsyncJobResultInterval = intervalLimit;						
+						}
+						
             userValid = true;
           },
           error: function(xmlHTTP) {
@@ -283,7 +290,14 @@
                 $.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
 				
                 g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
-
+								
+								if(json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax
!= null) {
+									var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval
* 1000) / json.listcapabilitiesresponse.capability.apilimitmax ) * 3; //multiply 3 to be on
safe side
+									//intervalLimit = 8888; //this line is for testing only, comment it before check
in
+									if(intervalLimit > g_queryAsyncJobResultInterval)
+										g_queryAsyncJobResultInterval = intervalLimit;		
+								}
+								
                 args.response.success({
                   data: {
                     user: $.extend(true, {}, loginresponse, {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06a733a8/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 51c4fdb..026089f 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -26,6 +26,7 @@ var g_timezone = null;
 var g_supportELB = null;
 var g_userPublicTemplateEnabled = "true";
 var g_cloudstackversion = null;
+var g_queryAsyncJobResultInterval = 6000;
 
 //keyboard keycode
 var keycode_Enter = 13;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06a733a8/ui/scripts/ui/widgets/notifications.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/notifications.js b/ui/scripts/ui/widgets/notifications.js
index e98d4d8..0299603 100644
--- a/ui/scripts/ui/widgets/notifications.js
+++ b/ui/scripts/ui/widgets/notifications.js
@@ -93,7 +93,7 @@
       $total.parent().addClass('pending');
       $item.addClass('pending');
 
-      // Setup timer
+      // Setup timer			
       var pollTimer = setInterval(function() {
         args.poll({
           _custom: _custom,
@@ -281,7 +281,7 @@
         cloudStack.ui.event.call('addNotification', {
           section: notification.section,
           desc: notification.desc,
-          interval: notification.interval ? notification.interval : 5000,
+          interval: notification.interval ? notification.interval : g_queryAsyncJobResultInterval,
           _custom: notification._custom,
           poll: function(args) {
             var complete = args.complete;


Mime
View raw message