V6.0 Phase 3 - Add cloudflare tunnel. Remote access to app via the tunnel now working.
Quality Gate / gate (push) Failing after 49s

This commit is contained in:
Jim Lancaster
2026-08-25 13:05:47 -05:00
parent faa30fd27b
commit 234476ba6d
10 changed files with 136 additions and 9 deletions
+20 -5
View File
@@ -26,6 +26,18 @@ from .base import ServiceBase
logger = logging.getLogger(__name__)
def _utc_now_naive() -> datetime:
"""Return current UTC as naive datetime for DB timestamp columns."""
return datetime.now(UTC).replace(tzinfo=None)
def _as_naive_utc(value: datetime) -> datetime:
"""Normalize datetimes to naive UTC for DB comparisons/binds."""
if value.tzinfo is None:
return value
return value.astimezone(UTC).replace(tzinfo=None)
class JobDeleteBlockedError(AppError):
"""Raised when a job delete operation is blocked by lifecycle policy."""
@@ -201,7 +213,7 @@ class JobService(ServiceBase):
await self._finalize(session=_session, caller_session=session, refresh=(job,))
return job
now = datetime.now(UTC)
now = _utc_now_naive()
queued_job_id = (
select(col(Job.id))
.where(col(Job.status) == JobStatus.QUEUED)
@@ -239,12 +251,15 @@ class JobService(ServiceBase):
``stale_before`` are considered stale and re-queued.
"""
async with self._session_scope(session) as _session:
query = select(Job).where(Job.status == JobStatus.PROCESSING).where(Job.date_updated < stale_before)
normalized_stale_before = _as_naive_utc(stale_before)
query = (
select(Job).where(Job.status == JobStatus.PROCESSING).where(Job.date_updated < normalized_stale_before)
)
stale_jobs = (await _session.exec(query)).all()
if not stale_jobs:
return 0
now = datetime.now(UTC)
now = _utc_now_naive()
for job in stale_jobs:
job.status = JobStatus.QUEUED
job.date_updated = now
@@ -352,7 +367,7 @@ class JobService(ServiceBase):
suggestion="Use resubmit for reprocessing needs, or leave the terminal job unchanged.",
)
now = datetime.now(UTC)
now = _utc_now_naive()
job.status = JobStatus.FAILED
job.date_updated = now
@@ -398,7 +413,7 @@ class JobService(ServiceBase):
suggestion="Only failed or cancelled sources can be resubmitted.",
)
now = datetime.now(UTC)
now = _utc_now_naive()
for job_source in candidates:
job_source.status = JobSourceStatus.PENDING