refactor: fix naming, remove duplicate code from decomposition
- Rename _int_or_default → int_or_default (public API, was using private convention) - Extract shared pdf_queue utilities (utcnow, event_row, queued_job, status constants) to pdf_queue_common.py to avoid circular imports - Consolidate _effective_request_delay_seconds into queue_runner.py with explicit floor parameter - Update tests to match new function locations and names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
74249fa24c
commit
3fd9132176
9 changed files with 104 additions and 128 deletions
|
|
@ -20,7 +20,7 @@ from app.settings import settings
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _effective_request_delay_seconds(value: int | None, *, floor: int) -> int:
|
||||
def effective_request_delay_seconds(value: int | None, *, floor: int) -> int:
|
||||
try:
|
||||
parsed = int(value) if value is not None else floor
|
||||
except (TypeError, ValueError):
|
||||
|
|
@ -238,7 +238,7 @@ class QueueJobRunner:
|
|||
select(UserSetting.request_delay_seconds).where(UserSetting.user_id == user_id)
|
||||
)
|
||||
delay = result.scalar_one_or_none()
|
||||
return _effective_request_delay_seconds(delay, floor=floor)
|
||||
return effective_request_delay_seconds(delay, floor=floor)
|
||||
|
||||
async def _run_ingestion_for_queue_job(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue