fix: scheduler memory 128Mi→256Mi, fix backfill script SQL param bug
This commit is contained in:
@@ -19,8 +19,8 @@ services:
|
|||||||
tier: orchestration
|
tier: orchestration
|
||||||
secrets: [stonks-core-secrets]
|
secrets: [stonks-core-secrets]
|
||||||
resources:
|
resources:
|
||||||
requests: { cpu: 50m, memory: 64Mi }
|
requests: { cpu: 50m, memory: 128Mi }
|
||||||
limits: { cpu: 200m, memory: 128Mi }
|
limits: { cpu: 200m, memory: 256Mi }
|
||||||
|
|
||||||
symbolRegistry:
|
symbolRegistry:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import argparse
|
|||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
@@ -42,8 +43,8 @@ FROM market_snapshots
|
|||||||
WHERE ticker = $1
|
WHERE ticker = $1
|
||||||
AND snapshot_type = 'bar'
|
AND snapshot_type = 'bar'
|
||||||
AND data->>'c' IS NOT NULL
|
AND data->>'c' IS NOT NULL
|
||||||
AND captured_at >= $2 - INTERVAL '24 hours'
|
AND captured_at >= $2
|
||||||
AND captured_at <= $2
|
AND captured_at <= $3
|
||||||
ORDER BY captured_at DESC
|
ORDER BY captured_at DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
"""
|
"""
|
||||||
@@ -102,8 +103,9 @@ async def backfill(dry_run: bool = False) -> None:
|
|||||||
price: float | None = None
|
price: float | None = None
|
||||||
|
|
||||||
# Fallback 1: market_snapshots within 24h of generated_at
|
# Fallback 1: market_snapshots within 24h of generated_at
|
||||||
|
window_start = generated_at - timedelta(hours=24)
|
||||||
market_row = await pool.fetchrow(
|
market_row = await pool.fetchrow(
|
||||||
_MARKET_SNAPSHOT_FALLBACK_SQL, ticker, generated_at
|
_MARKET_SNAPSHOT_FALLBACK_SQL, ticker, window_start, generated_at
|
||||||
)
|
)
|
||||||
if market_row and market_row["close"] is not None:
|
if market_row and market_row["close"] is not None:
|
||||||
price = float(market_row["close"])
|
price = float(market_row["close"])
|
||||||
|
|||||||
Reference in New Issue
Block a user