fix async

This commit is contained in:
2025-05-27 23:50:25 +02:00
parent 670972bd45
commit c40378b654
17 changed files with 181 additions and 210 deletions

View File

@@ -6,7 +6,7 @@ import logging
logger = logging.getLogger(__name__)
async def main_loader(cfg: object, id: int, action: str) -> None:
async def main_loader(cfg: object, id: int, pool, action: str) -> None:
type_matrix_mapping = {
"pipe_separator": make_pipe_sep_matrix,
"analogic_digital": make_ain_din_matrix,
@@ -15,11 +15,11 @@ async def main_loader(cfg: object, id: int, action: str) -> None:
if action in type_matrix_mapping:
function_to_call = type_matrix_mapping[action]
# Create a matrix of values from the data
matrice_valori = function_to_call(cfg, id)
matrice_valori = await function_to_call(cfg, id, pool)
logger.info("matrice valori creata")
# Load the data into the database
if load_data(cfg, matrice_valori):
update_status(cfg, id, DATA_LOADED)
if await load_data(cfg, matrice_valori, pool):
await update_status(cfg, id, DATA_LOADED, pool)
else:
logger.warning(f"Action '{action}' non riconosciuta.")