mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 08:26:05 +08:00
Call register_scripts on connecting redis (#6361)
### What problem does this PR solve? Call register_scripts on connecting redis ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
674f94228b
commit
ca9c3e59fa
@ -62,12 +62,10 @@ class RedisDB:
|
|||||||
self.REDIS = None
|
self.REDIS = None
|
||||||
self.config = settings.REDIS
|
self.config = settings.REDIS
|
||||||
self.__open__()
|
self.__open__()
|
||||||
self.register_scripts()
|
|
||||||
|
|
||||||
def register_scripts(self) -> None:
|
def register_scripts(self) -> None:
|
||||||
cls = self.__class__
|
cls = self.__class__
|
||||||
client = self.REDIS
|
client = self.REDIS
|
||||||
if cls.lua_delete_if_equal is None:
|
|
||||||
cls.lua_delete_if_equal = client.register_script(cls.LUA_DELETE_IF_EQUAL_SCRIPT)
|
cls.lua_delete_if_equal = client.register_script(cls.LUA_DELETE_IF_EQUAL_SCRIPT)
|
||||||
|
|
||||||
def __open__(self):
|
def __open__(self):
|
||||||
@ -79,6 +77,7 @@ class RedisDB:
|
|||||||
password=self.config.get("password"),
|
password=self.config.get("password"),
|
||||||
decode_responses=True,
|
decode_responses=True,
|
||||||
)
|
)
|
||||||
|
self.register_scripts()
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.warning("Redis can't be connected.")
|
logging.warning("Redis can't be connected.")
|
||||||
return self.REDIS
|
return self.REDIS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user