Allow threading for sync `use_effect` calls
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 8.1k
- Forks
- 332
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de reactive-python/reactpy
-
Outdated GIF in Docs Ouvertepriority-3-low type-docs
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
reactive-python/reactpy#1034 ·
-
priority-2-moderate type-revision
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
reactive-python/reactpy#1319 ·
-
priority-1-high
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
reactive-python/reactpy#1277 ·
-
priority-3-low
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
reactive-python/reactpy#1273 · 1 réaction ·
-
priority-2-moderate
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
reactive-python/reactpy#1272 · 2 réactions ·
Toutes les issues de reactive-python/reactpy
Issues similaires
-
🐛 Bug 🔔 Pending processing
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
jumpserver/jumpserver#17584 ·
-
link-check link-check:sphinx-theme
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
OpenHands/extensions#626 · 1 commentaire ·
-
Change observation tooltip text Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
CSCfi/sd-search-api#39 ·