Skip to content

Commit

Permalink
fix: 修复字段错误,凭据刷新从第二天开始
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoaer committed Dec 1, 2023
1 parent c8fca7f commit f174a3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def upper_thumb():
other_tasks.extend(
[
upper.save_metadata(),
download_content(upper.thumb_url, upper.thumb_path),
download_content(upper.thumb, upper.thumb_path),
]
)
await asyncio.gather(*makedir_tasks)
Expand Down
6 changes: 4 additions & 2 deletions processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit f174a3b

Please sign in to comment.