fix: scheduler memory 128Mi→256Mi, fix backfill script SQL param bug

This commit is contained in:
Celes Renata
2026-07-11 17:23:52 +00:00
parent 81ed2f0803
commit 2f966b1caf
2 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -18,6 +18,7 @@ import argparse
import asyncio
import os
import sys
from datetime import timedelta
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -42,8 +43,8 @@ FROM market_snapshots
WHERE ticker = $1
AND snapshot_type = 'bar'
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
LIMIT 1
"""
@@ -102,8 +103,9 @@ async def backfill(dry_run: bool = False) -> None:
price: float | None = None
# Fallback 1: market_snapshots within 24h of generated_at
window_start = generated_at - timedelta(hours=24)
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:
price = float(market_row["close"])