reactive-python / reactpy-django

It's React, but in Python. Now with Django integration.
https://reactive-python.github.io/reactpy-django/
MIT License
322 stars 18 forks source link

v3.3.2 #170

Closed Archmonger closed 1 year ago

Archmonger commented 1 year ago

By submitting this pull request you agree that all contributions to this project are made under the MIT license.

Description

Added

Fixed

Archmonger commented 1 year ago

@rmorshea I'm going to merge this as a temporary hotfix, but I'm honestly kind of shocked using nest_asyncio fixes both assert f is self._write_fut exceptions on Uvicorn and also jittery rendering behavior Daphne.

My best guess is the way that the Windows ProactorEventLoop enqueues tasks is inherently not thread safe, and maybe nest_asyncio serializes this task queue? I'm even more shocked that this results in a overall performance improvement.

There's still one open bug: Some Windows environments have degraded performance when running via backhaul thread. I've actually experienced this once in the past, but I've been unable to replicate it.

Will need to do a deeper dive into this in the future. Given that the issue existed for me before but is now gone (same Python version), this is likely somehow related to CPython optimizations.