fix: 修复字段错误,凭据刷新从第二天开始

This commit is contained in:
amtoaer
2023-12-02 00:46:21 +08:00
parent c8fca7fcca
commit f174a3b898
2 changed files with 5 additions and 3 deletions

View File

@@ -81,10 +81,12 @@ async def manage_model(medias: list[dict], fav_list: FavoriteList) -> None:
async def process() -> None:
global anchor
if datetime.date.today() >= anchor and await credential.check_refresh():
if (
today := datetime.date.today()
) > anchor and await credential.check_refresh():
try:
await credential.refresh()
anchor = datetime.date.today() + datetime.timedelta(days=1)
anchor = today
logger.info("Credential refreshed.")
except Exception:
logger.exception("Failed to refresh credential.")