Prewarm default scan terminal payload
This commit is contained in:
@@ -9,6 +9,7 @@ from web.scan_terminal_payloads import (
|
|||||||
from web.scan_terminal_ranker import build_ranked_scan_terminal_result
|
from web.scan_terminal_ranker import build_ranked_scan_terminal_result
|
||||||
from web.scan_terminal_city_row import _build_quick_row
|
from web.scan_terminal_city_row import _build_quick_row
|
||||||
from web.routers.scan import router as scan_router
|
from web.routers.scan import router as scan_router
|
||||||
|
from web.scan_terminal_service import _scan_terminal_prewarm_filters
|
||||||
|
|
||||||
|
|
||||||
class _FakeRedis:
|
class _FakeRedis:
|
||||||
@@ -70,6 +71,13 @@ def test_scan_terminal_failure_state_preserves_redis_success_payload(monkeypatch
|
|||||||
assert entry["last_error"] == "timeout"
|
assert entry["last_error"] == "timeout"
|
||||||
|
|
||||||
|
|
||||||
|
def test_scan_terminal_prewarm_covers_default_api_limit():
|
||||||
|
limits = {filters["limit"] for filters in _scan_terminal_prewarm_filters()}
|
||||||
|
|
||||||
|
assert 25 in limits
|
||||||
|
assert 180 in limits
|
||||||
|
|
||||||
|
|
||||||
def test_scan_router_does_not_expose_terminal_ai_endpoint():
|
def test_scan_router_does_not_expose_terminal_ai_endpoint():
|
||||||
routes = {
|
routes = {
|
||||||
getattr(route, "path", None): getattr(route, "methods", set())
|
getattr(route, "path", None): getattr(route, "methods", set())
|
||||||
|
|||||||
@@ -343,6 +343,16 @@ def build_scan_terminal_payload(
|
|||||||
_SCAN_PREWARM_STARTED = False
|
_SCAN_PREWARM_STARTED = False
|
||||||
_SCAN_PREWARM_LOCK = threading.Lock()
|
_SCAN_PREWARM_LOCK = threading.Lock()
|
||||||
_SCAN_TERMINAL_PREWARM_RAW_FILTERS = [
|
_SCAN_TERMINAL_PREWARM_RAW_FILTERS = [
|
||||||
|
{
|
||||||
|
"scan_mode": "tradable",
|
||||||
|
"min_price": 0.05,
|
||||||
|
"max_price": 0.95,
|
||||||
|
"min_edge_pct": 2,
|
||||||
|
"min_liquidity": 500,
|
||||||
|
"market_type": "maxtemp",
|
||||||
|
"time_range": "today",
|
||||||
|
"limit": 25,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"scan_mode": "tradable",
|
"scan_mode": "tradable",
|
||||||
"min_price": 0.05,
|
"min_price": 0.05,
|
||||||
|
|||||||
Reference in New Issue
Block a user