fix(lint): add timezone import, use timedelta directly, remove unused variable
This commit is contained in:
@@ -13,7 +13,7 @@ functions wrapped with asyncio.run_coroutine_threadsafe().
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from datetime import date, datetime, time, timedelta, timezone
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
@@ -170,7 +170,7 @@ async def _auto_pause_stale_projects(user_id: int) -> list[str]:
|
||||
from fabledassistant.models import async_session as _session
|
||||
|
||||
paused: list[str] = []
|
||||
threshold = datetime.now(timezone.utc) - __import__('datetime').timedelta(days=14)
|
||||
threshold = datetime.now(timezone.utc) - timedelta(days=14)
|
||||
try:
|
||||
async with _session() as session:
|
||||
projects = (await session.execute(
|
||||
@@ -222,7 +222,7 @@ async def _run_slot_for_user(user_id: int, slot: str) -> None:
|
||||
|
||||
if slot == "compilation":
|
||||
# Auto-pause stale projects before compiling the briefing
|
||||
auto_paused = await _auto_pause_stale_projects(user_id)
|
||||
await _auto_pause_stale_projects(user_id)
|
||||
|
||||
# Refresh external data first
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user