Initial commit: Robot ökoszisztéma v2.0 - Stabilizált jármű és szerviz robotok

This commit is contained in:
Kincses
2026-03-04 02:03:03 +01:00
commit 250f4f4b8f
7942 changed files with 449625 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
# /opt/docker/dev/service_finder/backend/app/services/robot_manager.py
import asyncio
import logging
from datetime import datetime
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. """
logger.info(f"🕒 Teljes szinkronizáció indítva: {datetime.now()}")
robots = [
VehicleHarvester(),
# BikeHarvester(), # Későbbi bővítéshez
]
for robot in robots:
try:
# 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:
logger.error(f"❌ Kritikus hiba a {robot.category} robotnál: {e}")
@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) # Megakadályozzuk az újraindulást ugyanabban a percben
await asyncio.sleep(30)