Skip to content

Commit 243aef4

Browse files
committed
BUGFIX:
- Scheduler: index error in mission rotate
1 parent 4b4148b commit 243aef4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugins/scheduler/commands.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ async def _run_without_presets(self, server: Server, rconf: dict, new_mission: i
419419

420420
async def run_action(self, server: Server, rconf: dict):
421421
method = rconf['method']
422+
mission_list = await server.getMissionList()
423+
422424
if method == 'shutdown' or rconf.get('shutdown', False):
423425
self.log.debug(f"{self.__cog_name__}: Shutting down server {server.name} ...")
424426
await self.teardown_dcs(server)
@@ -447,9 +449,10 @@ async def run_action(self, server: Server, rconf: dict):
447449
new_mission = int(server.settings.get('listStartIndex', 1))
448450
if method == 'rotate':
449451
new_mission += 1
452+
if new_mission > len(mission_list):
453+
new_mission = 1
450454

451455
# do we change the running mission?
452-
mission_list = await server.getMissionList()
453456
if server.status in [Status.RUNNING, Status.PAUSED] and server.current_mission:
454457
new_mission_file = mission_list[new_mission - 1]
455458
is_running_mission = (new_mission_file == server.current_mission.filename)

0 commit comments

Comments
 (0)