STABLE: Final schema sync, optimized gitignore

This commit is contained in:
Kincses
2026-02-26 08:19:25 +01:00
parent 893f39fa15
commit 505543330a
203 changed files with 11590 additions and 9542 deletions

View File

@@ -1,27 +1,27 @@
# /app/services/robot_manager.py
# /opt/docker/dev/service_finder/backend/app/services/robot_manager.py
import asyncio
import logging
from datetime import datetime
from .harvester_cars import CarHarvester
# Megjegyzés: Ellenőrizd, hogy a harvester_bikes/trucks fájlokban is BaseHarvester az alap!
from .harvester_cars import VehicleHarvester
# Megjegyzés: Csak azokat importáld, amik öröklődnek a BaseHarvester-ből
logger = logging.getLogger(__name__)
class RobotManager:
@staticmethod
async def run_full_sync(db):
"""Sorban lefuttatja a robotokat az új AssetCatalog struktúrához."""
""" Sorban lefuttatja a robotokat az új AssetCatalog struktúrához. """
logger.info(f"🕒 Teljes szinkronizáció indítva: {datetime.now()}")
robots = [
CarHarvester(),
# BikeHarvester(),
# TruckHarvester()
VehicleHarvester(),
# BikeHarvester(), # Későbbi bővítéshez
]
for robot in robots:
try:
await robot.run(db)
# JAVÍTVA: A modern Harvesterek a harvest_all metódust használják
await robot.harvest_all(db)
logger.info(f"{robot.category} robot sikeresen lefutott.")
await asyncio.sleep(5)
except Exception as e:
@@ -29,9 +29,12 @@ class RobotManager:
@staticmethod
async def schedule_nightly_run(db):
"""
LOGIKA MEGŐRIZVE: Éjszakai futtatás 02:00-kor.
"""
while True:
now = datetime.now()
if now.hour == 2 and now.minute == 0:
await RobotManager.run_full_sync(db)
await asyncio.sleep(70)
await asyncio.sleep(70) # Megakadályozzuk az újraindulást ugyanabban a percben
await asyncio.sleep(30)