Batch scan terminal model forecasts
This commit is contained in:
+3
-12
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from fastapi import APIRouter, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from web.services.cache_headers import NO_STORE_CACHE_CONTROL, public_edge_cache_control
|
||||
from web.services.cache_headers import NO_STORE_CACHE_CONTROL
|
||||
from web.services.scan_api import (
|
||||
get_scan_terminal_overview_payload,
|
||||
get_scan_terminal_payload,
|
||||
@@ -14,9 +14,6 @@ from web.services.request_timing import attach_server_timing_header
|
||||
|
||||
router = APIRouter(tags=["scan"])
|
||||
|
||||
SCAN_TERMINAL_CACHE_CONTROL = public_edge_cache_control(300, 900)
|
||||
|
||||
|
||||
@router.get("/api/scan/terminal")
|
||||
async def scan_terminal(
|
||||
request: Request,
|
||||
@@ -53,17 +50,11 @@ async def scan_terminal(
|
||||
region=region or trading_region or None,
|
||||
timezone_offset_seconds=timezone_offset_seconds,
|
||||
)
|
||||
status = str(payload.get("status") or "").strip().lower()
|
||||
cache_control = (
|
||||
SCAN_TERMINAL_CACHE_CONTROL
|
||||
if not force_refresh and status == "ready" and payload.get("stale") is not True
|
||||
else NO_STORE_CACHE_CONTROL
|
||||
)
|
||||
response = JSONResponse(
|
||||
content=payload,
|
||||
headers={
|
||||
"Cache-Control": cache_control,
|
||||
"Cloudflare-CDN-Cache-Control": cache_control,
|
||||
"Cache-Control": NO_STORE_CACHE_CONTROL,
|
||||
"Cloudflare-CDN-Cache-Control": NO_STORE_CACHE_CONTROL,
|
||||
},
|
||||
)
|
||||
attach_server_timing_header(response, request, "scan_terminal_server_timing")
|
||||
|
||||
Reference in New Issue
Block a user