diff --git a/mapadroid/mapping_manager/MappingManager.py b/mapadroid/mapping_manager/MappingManager.py index f842422a2..549a9c668 100644 --- a/mapadroid/mapping_manager/MappingManager.py +++ b/mapadroid/mapping_manager/MappingManager.py @@ -557,7 +557,7 @@ async def routemanager_recalculate(self, routemanager_id: int) -> bool: return False try: try: - await routemanager.start_routemanager() + await routemanager.start_routemanager(skip_calculate=True) except RoutemanagerShuttingDown as e: logger.warning("Unable to start routemanager for recalc: {}", e) return False diff --git a/mapadroid/route/RouteManagerBase.py b/mapadroid/route/RouteManagerBase.py index c98327cbe..0872e4f64 100644 --- a/mapadroid/route/RouteManagerBase.py +++ b/mapadroid/route/RouteManagerBase.py @@ -268,7 +268,7 @@ def add_coord_to_be_removed(self, lat: float, lon: float): return self._coords_to_be_ignored.add(Location(lat, lon)) - async def start_routemanager(self) -> bool: + async def start_routemanager(self, skip_calculate: bool = False) -> bool: """ Starts priority queue or whatever the implementations require :return: @@ -278,7 +278,8 @@ async def start_routemanager(self) -> bool: self._is_started.set() self._coords_to_be_ignored.clear() logger.info("Starting routemanager {}", self.name) - await self.calculate_route(dynamic=False, overwrite_persisted_route=False) + if not skip_calculate: + await self.calculate_route(dynamic=False, overwrite_persisted_route=False) await self._start_priority_queue() await self._start_check_routepools() self._init_route_queue() diff --git a/mapadroid/route/RouteManagerLeveling.py b/mapadroid/route/RouteManagerLeveling.py index 8ead6e8d2..931d0b2db 100644 --- a/mapadroid/route/RouteManagerLeveling.py +++ b/mapadroid/route/RouteManagerLeveling.py @@ -143,7 +143,7 @@ async def _any_coords_left_after_finishing_route(self) -> bool: return await self._update_routepool() - async def start_routemanager(self): + async def start_routemanager(self, skip_calculate: bool = False): async with self._manager_mutex: if not self._is_started.is_set(): self._is_started.set() diff --git a/mapadroid/route/RouteManagerQuests.py b/mapadroid/route/RouteManagerQuests.py index 3176cce47..0fd3aa67e 100644 --- a/mapadroid/route/RouteManagerQuests.py +++ b/mapadroid/route/RouteManagerQuests.py @@ -102,7 +102,7 @@ async def _any_coords_left_after_finishing_route(self) -> bool: return False return True - async def start_routemanager(self): + async def start_routemanager(self, skip_calculate: bool = False): if self._shutdown_route.is_set(): logger.info('Route is shutting down already.') return False @@ -114,7 +114,8 @@ async def start_routemanager(self): logger.info("Starting routemanager") self._is_started.set() - await self.calculate_route(dynamic=True, overwrite_persisted_route=False) + if not skip_calculate: + await self.calculate_route(dynamic=True, overwrite_persisted_route=False) await self._start_check_routepools() logger.info('Getting {} positions in route', len(self._route))