Repository: kylin
Updated Branches:
  refs/heads/master c051fb815 -> a8f35cf26


KYLIN-3114, Make timeout for the queries submitted through the Web UI 
configurable

Signed-off-by: shaofengshi <[email protected]>


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

Branch: refs/heads/master
Commit: a8f35cf26df452857dc4d7e1bc2a5d279bf7b13e
Parents: c051fb8
Author: Seva Ostapenko <[email protected]>
Authored: Fri Dec 15 16:40:37 2017 -0500
Committer: shaofengshi <[email protected]>
Committed: Wed Dec 20 18:16:03 2017 +0800

----------------------------------------------------------------------
 .../src/main/resources/kylin-defaults.properties       |  3 +++
 webapp/app/js/services/kylinProperties.js              | 12 ++++++++++++
 webapp/app/js/services/query.js                        | 13 +++++++++++--
 3 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/a8f35cf2/core-common/src/main/resources/kylin-defaults.properties
----------------------------------------------------------------------
diff --git a/core-common/src/main/resources/kylin-defaults.properties 
b/core-common/src/main/resources/kylin-defaults.properties
index b708dbe..6ca516d 100644
--- a/core-common/src/main/resources/kylin-defaults.properties
+++ b/core-common/src/main/resources/kylin-defaults.properties
@@ -43,6 +43,9 @@ kylin.server.cluster-servers=localhost:7070
 # Display timezone on UI,format like[GMT+N or GMT-N]
 kylin.web.timezone=GMT+8
 
+# Timeout value for the queries submitted through the Web UI, in milliseconds
+kylin.web.query-timeout=300000
+
 kylin.web.cross-domain-enabled=true
 
 # Hide measures in measure list of cube designer, separate by comma

http://git-wip-us.apache.org/repos/asf/kylin/blob/a8f35cf2/webapp/app/js/services/kylinProperties.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/kylinProperties.js 
b/webapp/app/js/services/kylinProperties.js
index fa92e53..74e5bba 100644
--- a/webapp/app/js/services/kylinProperties.js
+++ b/webapp/app/js/services/kylinProperties.js
@@ -119,5 +119,17 @@ KylinApp.service('kylinConfig', function (AdminService, 
$log) {
     var hide_measures = 
this.getProperty("kylin.web.hide-measures").replace(/\s/g,"").toUpperCase();
     return hide_measures.split(",")
   }
+
+  this.getQueryTimeout = function () {
+    var queryTimeout = parseInt(this.getProperty("kylin.web.query-timeout"));
+    if (isNaN(queryTimeout)) {
+       queryTimeout = 300000;
+    }
+    return queryTimeout;
+  }
+
+  this.isInitialized = function() {
+    return angular.isString(_config);
+  }  
 });
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/a8f35cf2/webapp/app/js/services/query.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/query.js b/webapp/app/js/services/query.js
index 6434a7e..3d67e73 100644
--- a/webapp/app/js/services/query.js
+++ b/webapp/app/js/services/query.js
@@ -16,9 +16,18 @@
  * limitations under the License.
 */
 
-KylinApp.factory('QueryService', ['$resource', function ($resource, config) {
+KylinApp.factory('QueryService', ['$resource', 'kylinConfig', function 
($resource, kylinConfig, config) {
+    var queryTimeout;
+    if (kylinConfig.isInitialized()) {
+      queryTimeout = kylinConfig.getQueryTimeout();
+    } else { 
+      kylinConfig.init().$promise.then(function (data) {
+        kylinConfig.initWebConfigInfo();
+        queryTimeout = kylinConfig.getQueryTimeout();
+      });
+    }
     return $resource(Config.service.url + 
':subject/:subject_id/:propName/:propValue/:action', {}, {
-        query: {method: 'POST', params: {action: 'query'},timeout:300000, 
isArray: false},
+        query: {method: 'POST', params: {action: 'query'}, timeout: 
queryTimeout, isArray: false},
         save: {method: 'POST', params: {subject: 'saved_queries'}, isArray: 
false},
         delete: {method: 'DELETE', params: {subject: 'saved_queries'}, 
isArray: false},
         list: {method: 'GET', params: {subject: 'saved_queries'}, isArray: 
true},

Reply via email to