This commit is contained in:
2026-07-20 10:26:58 +08:00
parent 9658015972
commit 1d8fe97a49
10 changed files with 105 additions and 45 deletions
+10 -5
View File
@@ -64,13 +64,18 @@ async def auto_renew_job():
await db.flush()
try:
success, msg = service.renew_certificate(d.domain)
success, msg, cert_info, raw_output = service.renew_certificate(d.domain)
log.status = "success" if success else "failed"
log.message = msg
if success:
info = service.get_cert_info(d.domain)
if info:
d.cert_not_after = datetime.fromisoformat(info["not_after"])
log.detail = raw_output[-5000:] if raw_output else None
if success and cert_info.get("not_after"):
d.cert_not_after = datetime.fromisoformat(cert_info["not_after"])
d.version = str(int(d.version or "0") + 1)
log.cert_not_after = d.cert_not_after
log.cert_serial = cert_info.get("serial_number", "")
log.cert_san = ", ".join(cert_info.get("san", []))
renewed += 1
elif success:
d.version = str(int(d.version or "0") + 1)
renewed += 1
logger.info(f"[定时任务] {d.domain}: {'成功' if success else '失败'} - {msg}")