Skip to content

Commit

Permalink
Fix a non blocking start_server (#1117)
Browse files Browse the repository at this point in the history
This fixes the `RuntimeError: cannot schedule new futures after
interpreter shutdown`
  • Loading branch information
dsmilkov authored Jan 23, 2024
1 parent 77bd3d1 commit bd72e5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lilac/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def open_browser() -> None:

block = False
try:
asyncio.get_event_loop()
asyncio.get_running_loop()
except RuntimeError:
block = True

Expand Down
9 changes: 1 addition & 8 deletions lilac/server_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test our public REST API."""
import os
from time import sleep

from fastapi.testclient import TestClient
from pytest_mock import MockerFixture
Expand All @@ -13,7 +12,7 @@
UserInfo,
get_session_user,
)
from .server import app, start_server, stop_server
from .server import app

client = TestClient(app)

Expand Down Expand Up @@ -175,9 +174,3 @@ def user() -> UserInfo:
),
auth_enabled=True,
)


def test_start_and_stop_server() -> None:
start_server()
sleep(1)
stop_server()

0 comments on commit bd72e5c

Please sign in to comment.