Fix: Cache the SECRET_KEY, if it is not set, RAGFlow will auto gen one, but if Redis evict keys due to lack of memory, it will cause re-generate secret key, that cause all requests 401 (#17707)

This commit is contained in:
Wang Qi
2026-08-03 13:48:35 +08:00
committed by GitHub
parent 62457075d4
commit ab703b6ded

View File

@@ -175,7 +175,8 @@ def init_secret_key():
def get_secret_key():
global SECRET_KEY
if SECRET_KEY is None:
return _get_or_create_secret_key()
# Why need cache it, if REDIS evict keys due to lack of memory, new secret key will be generated, cause all requests 401
SECRET_KEY = _get_or_create_secret_key()
return SECRET_KEY