make logging not use f-str, change others to f-str (#22882)
This commit is contained in:
@@ -50,13 +50,13 @@ def encrypt(text: str, public_key: Union[str, bytes]) -> bytes:
|
||||
def get_decrypt_decoding(tenant_id: str) -> tuple[RSA.RsaKey, object]:
|
||||
filepath = os.path.join("privkeys", tenant_id, "private.pem")
|
||||
|
||||
cache_key = "tenant_privkey:{hash}".format(hash=hashlib.sha3_256(filepath.encode()).hexdigest())
|
||||
cache_key = f"tenant_privkey:{hashlib.sha3_256(filepath.encode()).hexdigest()}"
|
||||
private_key = redis_client.get(cache_key)
|
||||
if not private_key:
|
||||
try:
|
||||
private_key = storage.load(filepath)
|
||||
except FileNotFoundError:
|
||||
raise PrivkeyNotFoundError("Private key not found, tenant_id: {tenant_id}".format(tenant_id=tenant_id))
|
||||
raise PrivkeyNotFoundError(f"Private key not found, tenant_id: {tenant_id}")
|
||||
|
||||
redis_client.setex(cache_key, 120, private_key)
|
||||
|
||||
|
Reference in New Issue
Block a user