Android: `EditorService` does disk and SSL work on the caller's thread
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- android, kotlin
- Área
- mobile, performance
Línea de trabajo
Start with EditorService (create, prepare, fetchAssetBundleCount, cleanup, purge) and EditorDependenciesSerializer (writeToDisk, readFromDisk), then trace the disk and SSL calls into EditorAssetsLibrary.readAssetBundles and the EditorHTTPClient setup. Begin with the first proposed step: move the cleanup() call inside prepare onto Dispatchers.IO. Done means prepare is safe on the main thread, and every other listed API either runs off the caller's thread or documents that it blocks. The API shape is still undecided, so confirm the approach with maintainers before changing signatures.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
EditorService and EditorDependenciesSerializer do disk and SSL work on whichever thread calls them, so a host that calls them on the main thread gets slow frames and StrictMode violations. Nothing in the API or its KDoc says to avoid this.
No shipping host is affected today. WordPress-Android calls EditorService.create and prepare from a background dispatcher in GutenbergEditorPreloader. It also doesn't use the serializer or the other calls below, and its StrictMode setup is commented out. The cost is to the next host, and to the demo app, which wraps every call by hand (#489).
This is separate from #848, which covers the work inside GutenbergView that a host can't move. These are calls the host makes itself, so they can move.
What happens
| API | Blocking work | Why it matters |
|---|---|---|
EditorService.create |
EditorHTTPClient SSL setup, Paths.*Root, getSharedPreferences, EditorURLCache and EditorAssetsLibrary init |
Not suspend, so nothing suggests it blocks |
EditorService.prepare |
Periodic cleanup() → EditorAssetsLibrary.readAssetBundles |
It's suspend, so callers will expect it to be safe on the main thread |
EditorService.fetchAssetBundleCount |
EditorAssetsLibrary.readAssetBundles |
Not suspend |
EditorService.cleanup, purge |
Deletes files | Not suspend |
EditorDependenciesSerializer.writeToDisk, readFromDisk |
Reads or writes the dependencies file | Not suspend |
Possible fix
prepare: runcleanup()onDispatchers.IOinside the library. This has no API change and should come first.- The rest: make them
suspendand move toDispatchers.IOinside the library. This is a breaking change for hosts, though a small one, since WordPress-Android already callscreatefrom a coroutine. - If 2 is too disruptive: document the blocking calls in KDoc instead.
Done when
-
prepareis safe to call from the main thread. - Each API above either moves its work off the caller's thread or says in its KDoc that it blocks.
- The demo's
withContext(Dispatchers.IO)wrappers around these calls are removed where they're no longer needed.
Related issues
- #848 — editor load work inside
GutenbergView. - #489 — the demo app wrappers, and the review that raised this.
- Lenguaje dominante
- JavaScript
- Estrellas
- 29
- Forks
- 6
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 76
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de wordpress-mobile/GutenbergKit
-
[Type] Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
wordpress-mobile/GutenbergKit#940 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
wordpress-mobile/GutenbergKit#884 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug Android
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
wordpress-mobile/GutenbergKit#847 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug iOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
wordpress-mobile/GutenbergKit#846 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug [Type] Code Quality iOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
wordpress-mobile/GutenbergKit#668 ·
Los mantenedores suelen responder en 1 día
Todos los issues de wordpress-mobile/GutenbergKit
Issues similares
-
Remove: Tele Azul LogoAbiertocheck:passed logos:remove
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
intuitem/ciso-assistant-community#5380 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
TarteelAI/quranic-universal-library#1111 ·
Los mantenedores suelen responder en 1 día
-
area:ryoku type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
feedback simulation workshop
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
githubnext/gh-aw-workshop#6094 ·
Los mantenedores suelen responder en 1 día