Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_calculate flag to RouteManager.start_routemanager #1343

Open
wants to merge 1 commit into
base: async
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mapadroid/mapping_manager/MappingManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions mapadroid/route/RouteManagerBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion mapadroid/route/RouteManagerLeveling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions mapadroid/route/RouteManagerQuests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down