Skip to content

Commit 12a3346

Browse files
author
liuhuiqi.7
committed
feat(sdk): reload needed
1 parent 70d287b commit 12a3346

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

volcenginesdkarkruntime/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def _init_local_cert_cache(self):
585585
)
586586

587587
def get(self, ep: str) -> key_agreement_client:
588-
if ep in self._certificate_manager and not self._certificate_manager[ep].is_expired():
588+
if ep in self._certificate_manager and not self._certificate_manager[ep].need_reload():
589589
return self._certificate_manager[ep]
590590
cert_pem = self._load_cert_locally(ep)
591591
if cert_pem is None:

volcenginesdkarkruntime/_utils/_key_agreement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ def generate_ecies_key_pair(self) -> Tuple[bytes, bytes, str]:
211211
token = marshal_cryptography_pub_key(R)
212212
return key, nonce, base64.b64encode(token).decode()
213213

214-
def is_expired(self) -> bool:
215-
"""is_expired check if the cert is expired"""
216-
return time.time() > self._not_valid_after_utc
214+
def need_reload(self) -> bool:
215+
"""need_reload check if the cert need reload"""
216+
return time.time() > self._reload_time
217217

218218
def init_cert_ring_key_id(self) -> None:
219219
"""init_cert_ring_key_id init ring id and key id from cert"""

0 commit comments

Comments
 (0)