Skip to content

Commit

Permalink
Simplify event loop setup in config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
br3ndonland committed Jun 10, 2021
1 parent b66e11b commit e60ba66
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions uvicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,8 @@ def load(self) -> None:
self.loaded = True

def setup_event_loop(self) -> None:
loop_setup_str: Optional[str] = LOOP_SETUPS[self.loop]
if loop_setup_str:
loop_setup: Callable = import_from_string(loop_setup_str)
if not inspect.isfunction(loop_setup):
raise ImportFromStringError("Asyncio event loop must be a callable.")
else:
loop_setup()
loop_setup: Callable = import_from_string(LOOP_SETUPS[self.loop])
loop_setup()

def bind_socket(self) -> socket.socket:
family = socket.AF_INET
Expand Down

0 comments on commit e60ba66

Please sign in to comment.