fix(router.py): fix least-busy routing

This commit is contained in:
Krrish Dholakia 2023-12-08 20:29:37 -08:00
parent d9b115b8fb
commit 4bf875d3ed
8 changed files with 292 additions and 31 deletions

View file

@ -61,8 +61,6 @@ class InMemoryCache(BaseCache):
cached_response = json.loads(original_cached_response)
except:
cached_response = original_cached_response
if isinstance(cached_response, dict):
cached_response['cache'] = True # set cache-hit flag to True
return cached_response
return None
@ -110,8 +108,6 @@ class RedisCache(BaseCache):
cached_response = json.loads(cached_response) # Convert string to dictionary
except:
cached_response = ast.literal_eval(cached_response)
if isinstance(cached_response, dict):
cached_response['cache'] = True # set cache-hit flag to True
return cached_response
except Exception as e:
# NON blocking - notify users Redis is throwing an exception