Skip to content

system.py: Async functions should not call time.sleep #772

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

Merged
merged 1 commit into from
Jun 30, 2025
Merged
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
8 changes: 5 additions & 3 deletions mavsdk/system.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

import asyncio
import logging
import threading

Expand Down Expand Up @@ -107,12 +108,13 @@ async def connect(self, system_address=None):
"""

if self._server_process is not None:
# a mavsdk_server have already been launch by this instance:
# a mavsdk_server has already been launched by this instance:
# --> clean all before trying to reconnect
self._stop_mavsdk_server()

# add a delay to be sure recourses have been freed and restart mavsdk_server
import time; time.sleep(1)
# add a delay to be sure resources have been freed and restart mavsdk_server
await asyncio.sleep(1)


if self._mavsdk_server_address is None:
self._mavsdk_server_address = 'localhost'
Expand Down
Loading