refactor: 替换废弃的datetime.utcnow()为datetime.now(timezone.utc) (#805)
CI/CD Pipeline / Production Browser E2E (push) Failing after 1303h9m47s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1303h10m43s
CI/CD Pipeline / Build Production Web Image (push) Failing after 1303h10m45s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 1303h11m43s
CI/CD Pipeline / PR Build Web Image (push) Failing after 1303h11m44s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 1303h11m45s
CI/CD Pipeline / Validate - Code Quality (push) Failing after 3m48s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 1m53s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m56s
CI/CD Pipeline / Unit Tests (push) Successful in 6m14s
CI/CD Pipeline / Integration Tests (push) Successful in 2m42s
CI/CD Pipeline / Frontend Lint (push) Successful in 57s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 2m0s
CI/CD Pipeline / Deploy Production (push) Failing after 1303h42m15s
CI/CD Pipeline / Build Production API Image (push) Failing after 1303h43m13s
CI/CD Pipeline / Build Staging API Image (push) Successful in 16m28s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m23s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 8m33s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m44s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 37m24s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 38m43s
CI/CD Pipeline / PR Build API Image (push) Failing after 1303h44m10s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m15s

This commit was merged in pull request #805.
This commit is contained in:
2026-07-24 08:03:17 +08:00
parent 4208b5d940
commit b055200d0b
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone
import psycopg2
import redis
@@ -13,7 +13,7 @@ router = APIRouter(tags=["Health"])
async def health_check():
return {
"status": "healthy",
"timestamp": datetime.utcnow().isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
"version": settings.APP_VERSION,
}
@@ -33,7 +33,7 @@ async def startup_check():
all_ready = all(check["status"] == "healthy" for check in checks.values())
response = {
"status": "started" if all_ready else "starting",
"timestamp": datetime.utcnow().isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
"checks": checks,
}
if not all_ready:
+3 -3
View File
@@ -1,6 +1,6 @@
"""JWT Token 生成、验证、解析服务"""
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, Optional
import jwt
@@ -88,7 +88,7 @@ class JWTService(JWTServicePort):
Returns:
JWT Token 字符串
"""
now = datetime.utcnow()
now = datetime.now(timezone.utc)
expire = now + timedelta(minutes=self.config.ACCESS_TOKEN_EXPIRE_MINUTES) # noqa: E501
payload = {
@@ -115,7 +115,7 @@ class JWTService(JWTServicePort):
Returns:
JWT Token 字符串
"""
now = datetime.utcnow()
now = datetime.now(timezone.utc)
expire = now + timedelta(days=self.config.REFRESH_TOKEN_EXPIRE_DAYS)
payload = {