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

Python: remove unconditional sleep on spawn #4010

Merged
merged 1 commit into from
Oct 26, 2023
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
11 changes: 8 additions & 3 deletions rerun_py/rerun_sdk/rerun/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,14 @@ def spawn(
start_new_session=True,
)

# TODO(emilk): figure out a way to postpone connecting until the rerun viewer is listening.
# For example, wait until it prints "Hosting a SDK server over TCP at …"
sleep(0.5) # almost as good as waiting the correct amount of time
# Give the newly spawned Rerun Viewer some time to bind.
#
# NOTE: The timeout only covers the TCP handshake: if no process is bound to that address
# at all, the connection will fail immediately, irrelevant of the timeout configuration.
# For that reason we use an extra loop.
for _ in range(0, 5):
_check_for_existing_viewer(port)
sleep(0.1)

if connect:
_connect(f"127.0.0.1:{port}", recording=recording)
Loading