Files
service-finder/backend/app/services/robot_manager.py

22 lines
744 B
Python

import asyncio
from .harvester_robot import CarHarvester # A korábbi CarHarvester-t nevezzük át így
from .harvester_bikes import BikeHarvester
from .harvester_trucks import TruckHarvester
class RobotManager:
@staticmethod
async def run_full_sync(db):
"""Sorban lefuttatja az összes robotot."""
robots = [
CarHarvester(),
BikeHarvester(),
TruckHarvester()
]
for robot in robots:
try:
await robot.run(db)
# Pihenő a kategóriák között, hogy ne kapjunk IP-tiltást
await asyncio.sleep(5)
except Exception as e:
print(f"❌ Hiba a {robot.category} robotnál: {e}")