Allow threading for sync `use_effect` calls
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start by tracing how sync use_effect calls are handled alongside the ASGI websocket consumer and document the current main-thread behavior. Define whether the default should serialize effects through a single worker, how the proposed threading parameter restores legacy behavior, and whether configurable worker counts are in scope; done requires an agreed design and corresponding coverage.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Current Situation
Users frequently run into unexpected webserver "freezing" when using sync effects due to Python's single-threaded nature. This is seemingly caused by the ASGI websocket consumer being blocked from receiving/sending data during hook operations. This behavior doesn't seem to match up with equivalent JavaScript server side frameworks.
Proposed Actions
By default we should run all sync effects in a ThreadPoolExecutor(max_workers=1). This effectively runs all sync effects in a background thread. Additionally, by running all effects in the same worker thread (max_workers=1) this implementation is semi-threadsafe (as long as the user didn't start an operation outside of his use_effect call (which they shouldn't have under React-style programming). For operations that must run on the main thread, we need a @use_effect(threading: bool = ...) parameter to switch back to legacy behavior.
We could also consider a reactpy.config.USE_EFFECT_WORKERS=... setting to allow users to modify the value of max_workers.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 332
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus reactive-python/reactpy
-
Outdated GIF in Docs Offenpriority-3-low type-docs
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
reactive-python/reactpy#1034 ·
-
priority-2-moderate type-revision
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
reactive-python/reactpy#1319 ·
-
priority-1-high
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
reactive-python/reactpy#1277 ·
-
priority-3-low
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
reactive-python/reactpy#1273 · 1 Reaktion ·
-
priority-2-moderate
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
reactive-python/reactpy#1272 · 2 Reaktionen ·
Alle Issues in reactive-python/reactpy
Ähnliche Issues
-
documentation help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
simonw/sqlite-utils#872 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100