Skip to content

Commit

Permalink
faster spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Oct 25, 2023
1 parent 49d5e0c commit 3da1275
Showing 1 changed file with 8 additions and 3 deletions.
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)

0 comments on commit 3da1275

Please sign in to comment.