Skip to content

Commit

Permalink
Initialise asyncio.Event in the event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
MtkN1 committed Oct 29, 2024
1 parent e3c1379 commit 0662fc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sphinx_autobuild/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def __init__(
self.paths = [Path(path).resolve(strict=True) for path in paths]
self.ignore = ignore_filter
self.change_callback = change_callback
self.flag = asyncio.Event()
self.should_exit = asyncio.Event()

@asynccontextmanager
async def lifespan(self, _app) -> AbstractAsyncContextManager[None]:
self.flag = asyncio.Event()
self.should_exit = asyncio.Event()
task = asyncio.create_task(self.main())
yield
self.should_exit.set()
Expand Down

0 comments on commit 0662fc9

Please sign in to comment.