audio streaming app plyr.fm

fix: make sync_copyright_resolutions run automatically via docket Perpetual (#618)

The task was registered but never scheduled periodically. Adding
Perpetual(every=timedelta(minutes=5), automatic=True) makes it run
automatically every 5 minutes after worker startup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

authored by zzstoatzz.io

Claude Opus 4.5 and committed by
GitHub
f10724ce babe9121

+6 -3
+6 -3
backend/src/backend/_internal/background_tasks.py
··· 11 import os 12 import tempfile 13 import zipfile 14 - from datetime import UTC, datetime 15 from pathlib import Path 16 17 import aioboto3 18 import aiofiles 19 import logfire 20 from sqlalchemy import select 21 22 from backend._internal.atproto.records import ( ··· 52 logfire.info("scheduled copyright scan", track_id=track_id) 53 54 55 - async def sync_copyright_resolutions() -> None: 56 """sync resolution status from labeler to backend database. 57 58 finds tracks that are flagged but have no resolution, checks the labeler 59 to see if the labels were negated (dismissed), and marks them as resolved. 60 61 this replaces the lazy reconciliation that was happening on read paths. 62 - should be scheduled periodically (e.g., every 5 minutes). 63 """ 64 from backend._internal.moderation_client import get_moderation_client 65
··· 11 import os 12 import tempfile 13 import zipfile 14 + from datetime import UTC, datetime, timedelta 15 from pathlib import Path 16 17 import aioboto3 18 import aiofiles 19 import logfire 20 + from docket import Perpetual 21 from sqlalchemy import select 22 23 from backend._internal.atproto.records import ( ··· 53 logfire.info("scheduled copyright scan", track_id=track_id) 54 55 56 + async def sync_copyright_resolutions( 57 + perpetual: Perpetual = Perpetual(every=timedelta(minutes=5), automatic=True), # noqa: B008 58 + ) -> None: 59 """sync resolution status from labeler to backend database. 60 61 finds tracks that are flagged but have no resolution, checks the labeler 62 to see if the labels were negated (dismissed), and marks them as resolved. 63 64 this replaces the lazy reconciliation that was happening on read paths. 65 + runs automatically every 5 minutes via docket's Perpetual. 66 """ 67 from backend._internal.moderation_client import get_moderation_client 68