mirror of https://github.com/scrapy/scrapy.git
Do not install the requested event loop if it happens to match the existing one
This commit is contained in:
parent
476234b07a
commit
7668a693e8
|
|
@ -131,8 +131,10 @@ def set_asyncio_event_loop(event_loop_path: str | None) -> AbstractEventLoop:
|
|||
"""Sets and returns the event loop with specified import path."""
|
||||
if event_loop_path is not None:
|
||||
event_loop_class: type[AbstractEventLoop] = load_object(event_loop_path)
|
||||
event_loop = event_loop_class()
|
||||
asyncio.set_event_loop(event_loop)
|
||||
event_loop = _get_asyncio_event_loop()
|
||||
if not isinstance(event_loop, event_loop_class):
|
||||
event_loop = event_loop_class()
|
||||
asyncio.set_event_loop(event_loop)
|
||||
else:
|
||||
try:
|
||||
with catch_warnings():
|
||||
|
|
|
|||
Loading…
Reference in New Issue