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 asyncio
|
||||||
import logging
|
import logging
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta, timezone
|
||||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||||
|
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
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
|
from fabledassistant.models import async_session as _session
|
||||||
|
|
||||||
paused: list[str] = []
|
paused: list[str] = []
|
||||||
threshold = datetime.now(timezone.utc) - __import__('datetime').timedelta(days=14)
|
threshold = datetime.now(timezone.utc) - timedelta(days=14)
|
||||||
try:
|
try:
|
||||||
async with _session() as session:
|
async with _session() as session:
|
||||||
projects = (await session.execute(
|
projects = (await session.execute(
|
||||||
@@ -222,7 +222,7 @@ async def _run_slot_for_user(user_id: int, slot: str) -> None:
|
|||||||
|
|
||||||
if slot == "compilation":
|
if slot == "compilation":
|
||||||
# Auto-pause stale projects before compiling the briefing
|
# 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
|
# Refresh external data first
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user