Ping redis when needed
This commit is contained in:
parent
9db6b99f90
commit
cd1b4411d7
1 changed files with 3 additions and 0 deletions
|
@ -71,7 +71,10 @@ class OllamaView(View):
|
|||
class ChatHistory:
|
||||
def __init__(self):
|
||||
self._internal = {}
|
||||
no_ping = CONFIG["redis"].pop("no_ping", False)
|
||||
self.redis = redis.Redis(**CONFIG["redis"])
|
||||
if no_ping is False:
|
||||
assert self.redis.ping(), "Redis appears to be offline."
|
||||
|
||||
def load_thread(self, thread_id: str):
|
||||
value: str = self.redis.get("threads:" + thread_id)
|
||||
|
|
Loading…
Reference in a new issue