Skip to content

Comments

fix: use persistent event loop in file watcher to prevent crashes on Windows#77

Open
haosenwang1018 wants to merge 1 commit intozilliztech:mainfrom
haosenwang1018:fix/watcher-event-loop-windows
Open

fix: use persistent event loop in file watcher to prevent crashes on Windows#77
haosenwang1018 wants to merge 1 commit intozilliztech:mainfrom
haosenwang1018:fix/watcher-event-loop-windows

Conversation

@haosenwang1018
Copy link

Closes #75

On Windows, asyncio.run() creates and then closes a ProactorEventLoop on each call. After the first file change is processed, the closed loop causes httpcore's connection cleanup to fail with RuntimeError: Event loop is closed on subsequent file changes.

This fix replaces asyncio.run() with a persistent event loop (asyncio.new_event_loop()) that stays open across watcher callbacks, preventing the loop-closed error on repeat file modifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File wathcer doesn't work on windows

1 participant