Ver Fonte

HUE-8587 [jb] Make impala api cache url specific.

(cherry picked from commit c24f59e2f34a0c4a164219cc932a801b96d2b09f)
jdesjean há 7 anos atrás
pai
commit
c331f37
1 ficheiros alterados com 7 adições e 4 exclusões
  1. 7 4
      apps/impala/src/impala/server.py

+ 7 - 4
apps/impala/src/impala/server.py

@@ -38,15 +38,18 @@ API_CACHE_LOCK = threading.Lock()
 
 def get_api(user, url):
   global  API_CACHE
-  if API_CACHE is None:
+  if API_CACHE is None or API_CACHE.get(url) is None:
     API_CACHE_LOCK.acquire()
     try:
       if API_CACHE is None:
-        API_CACHE = ImpalaDaemonApi(url)
+        API_CACHE = {}
+      if API_CACHE.get(url) is None:
+        API_CACHE[url] = ImpalaDaemonApi(url)
     finally:
       API_CACHE_LOCK.release()
-  API_CACHE.set_user(user)
-  return API_CACHE
+  api = API_CACHE[url]
+  api.set_user(user)
+  return api
 
 
 def _get_impala_server_url(session):