feat: Allow caller to provide `loop` instance
@@ -225,10 +225,11 @@ def run(
sock = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM)
logger = get_logger(log_level)
- loop_setup = import_from_string(LOOP_SETUPS[loop])
http_protocol_class = import_from_string(HTTP_PROTOCOLS[http])
ws_protocol_class = import_from_string(WS_PROTOCOLS[ws])
+ if isinstance(loop, str):
+ loop_setup = import_from_string(LOOP_SETUPS[loop])
loop = loop_setup()
try:
