REFACTOR external service and improve websocket training
This commit is contained in:
@@ -6,7 +6,7 @@ Business operations for "what-if" scenario testing and strategic planning
|
||||
import structlog
|
||||
from fastapi import APIRouter, Depends, HTTPException, status, Path, Request
|
||||
from typing import List, Dict, Any
|
||||
from datetime import date, datetime, timedelta
|
||||
from datetime import date, datetime, timedelta, timezone
|
||||
import uuid
|
||||
|
||||
from app.schemas.forecasts import (
|
||||
@@ -65,7 +65,7 @@ async def simulate_scenario(
|
||||
**PROFESSIONAL/ENTERPRISE ONLY**
|
||||
"""
|
||||
metrics = get_metrics_collector(request_obj)
|
||||
start_time = datetime.utcnow()
|
||||
start_time = datetime.now(timezone.utc)
|
||||
|
||||
try:
|
||||
logger.info("Starting scenario simulation",
|
||||
@@ -131,7 +131,7 @@ async def simulate_scenario(
|
||||
)
|
||||
|
||||
# Calculate processing time
|
||||
processing_time_ms = int((datetime.utcnow() - start_time).total_seconds() * 1000)
|
||||
processing_time_ms = int((datetime.now(timezone.utc) - start_time).total_seconds() * 1000)
|
||||
|
||||
if metrics:
|
||||
metrics.increment_counter("scenario_simulations_success_total")
|
||||
@@ -160,7 +160,7 @@ async def simulate_scenario(
|
||||
insights=insights,
|
||||
recommendations=recommendations,
|
||||
risk_level=risk_level,
|
||||
created_at=datetime.utcnow(),
|
||||
created_at=datetime.now(timezone.utc),
|
||||
processing_time_ms=processing_time_ms
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user