fix: apply Phase 1-2 correctness and constant extraction from PR #273

- Replace datetime.utcnow() with datetime.now(timezone.utc) in 4 files
- Extract duplicate literals to constants in 5 files
  - models.py: "files.id" → _FILES_ID_FK
  - upload_to_email.py: "logo.png" → _LOGO_FILENAME
  - general.py: "%B %d, %Y" → _DATE_DISPLAY_FORMAT
  - files.py: "File not found" → _FILE_NOT_FOUND
  - upload_to_google_drive.py: Google token URL → _GOOGLE_TOKEN_URL

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-13 11:25:30 +00:00
parent fe32302adb
commit 4897cb6655
9 changed files with 38 additions and 23 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import logging
import threading
from collections import defaultdict
from datetime import datetime
from datetime import datetime, timezone
from app.database import SessionLocal
from app.models import FileProcessingStep, ProcessingLog
@@ -106,7 +106,7 @@ def log_task_progress(task_id, step_name, status, message=None, file_id=None, de
.first()
)
now = datetime.utcnow()
now = datetime.now(timezone.utc)
if not step_record:
# Create new step record
+2 -2
View File
@@ -6,7 +6,7 @@ This prevents files from getting stuck in "pending" state when processing crashe
"""
import logging
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Optional
from sqlalchemy.orm import Session
@@ -54,7 +54,7 @@ def mark_stalled_steps_as_failed(
if timeout_seconds is None:
timeout_seconds = get_step_timeout()
now = datetime.utcnow()
now = datetime.now(timezone.utc)
cutoff_time = now - timedelta(seconds=timeout_seconds)
# Query for stalled steps