From f67c6b5f46bd5609ef4ec7709c03b33ed0b3f832 Mon Sep 17 00:00:00 2001 From: Kim Pham Date: Wed, 30 Mar 2016 16:11:14 -0700 Subject: [PATCH 1/3] Fix a bug when loading DruidDatasource. --- caravel/viz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caravel/viz.py b/caravel/viz.py index 797c5363edeb9..5754685711cd1 100644 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -219,7 +219,8 @@ def cache_timeout(self): return self.slice.cache_timeout return ( self.datasource.cache_timeout or - self.datasource.database.cache_timeout or + # Kim: comment this out since it caused a bug for DruidDatasource. + # self.datasource.database.cache_timeout or config.get("CACHE_DEFAULT_TIMEOUT")) def get_json(self): From 4a77b70046054f655c292917b8b3de0027d18433 Mon Sep 17 00:00:00 2001 From: Kim Pham Date: Wed, 30 Mar 2016 16:28:08 -0700 Subject: [PATCH 2/3] A better fix. --- caravel/viz.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/caravel/viz.py b/caravel/viz.py index 5754685711cd1..c33430f0dff6c 100644 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -217,11 +217,12 @@ def query_obj(self): def cache_timeout(self): if self.slice and self.slice.cache_timeout: return self.slice.cache_timeout - return ( - self.datasource.cache_timeout or - # Kim: comment this out since it caused a bug for DruidDatasource. - # self.datasource.database.cache_timeout or - config.get("CACHE_DEFAULT_TIMEOUT")) + if self.datasource.cache_timeout: + return self.datasource.cache_timeout + if hasattr(self.datasource, 'database') \ + and self.datasource.database.cache_timeout: + return self.datasource.database.cache_timeout + return config.get("CACHE_DEFAULT_TIMEOUT") def get_json(self): """Handles caching around the json payload retrieval""" From e5553ab45eadc1dc46db72cba18eabaf0d51830d Mon Sep 17 00:00:00 2001 From: Kim Pham Date: Wed, 30 Mar 2016 16:35:37 -0700 Subject: [PATCH 3/3] Fix lint warning. --- caravel/viz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/caravel/viz.py b/caravel/viz.py index c33430f0dff6c..7d863fde321dd 100644 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -218,10 +218,10 @@ def cache_timeout(self): if self.slice and self.slice.cache_timeout: return self.slice.cache_timeout if self.datasource.cache_timeout: - return self.datasource.cache_timeout + return self.datasource.cache_timeout if hasattr(self.datasource, 'database') \ - and self.datasource.database.cache_timeout: - return self.datasource.database.cache_timeout + and self.datasource.database.cache_timeout: + return self.datasource.database.cache_timeout return config.get("CACHE_DEFAULT_TIMEOUT") def get_json(self):