refactor main.py
This commit is contained in:
22
backend/app/refresh_negative_prices.py
Normal file
22
backend/app/refresh_negative_prices.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Sdílený hook po importu cen / forecastu – obnova cache predikce záporných cen."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import asyncpg
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def refresh_negative_price_predictions(conn: asyncpg.Connection, site_id: int) -> None:
|
||||
try:
|
||||
await conn.fetch(
|
||||
"SELECT * FROM ems.fn_predict_negative_price_windows($1, 7)", site_id
|
||||
)
|
||||
except Exception:
|
||||
logger.warning(
|
||||
"fn_predict_negative_price_windows failed for site %s",
|
||||
site_id,
|
||||
exc_info=True,
|
||||
)
|
||||
Reference in New Issue
Block a user