Android: `EditorService` does disk and SSL work on the caller's thread
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- android, kotlin
- 领域
- mobile, performance
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 29
- 派生
- 6
- 平均合并
- 2 天 1 小时
- 30 天内合并 PR
- 76
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wordpress-mobile/GutenbergKit 的其他 Issue
-
[Type] Bug
难度 2/5 1-3 小时 新手友好度 74/100
wordpress-mobile/GutenbergKit#940 ·
维护者通常 1 天内回复
-
[Type] Bug
难度 2/5 1-3 小时 新手友好度 75/100
wordpress-mobile/GutenbergKit#884 ·
维护者通常 1 天内回复
-
[Type] Bug Android
难度 2/5 1-3 小时 新手友好度 79/100
wordpress-mobile/GutenbergKit#847 ·
维护者通常 1 天内回复
-
[Type] Bug iOS
难度 2/5 1-3 小时 新手友好度 77/100
wordpress-mobile/GutenbergKit#846 ·
维护者通常 1 天内回复
-
[Type] Bug [Type] Code Quality iOS
难度 2/5 1-3 小时 新手友好度 88/100
wordpress-mobile/GutenbergKit#668 ·
维护者通常 1 天内回复
查看 wordpress-mobile/GutenbergKit 的全部 Issue
相似的 Issue
-
check:passed logos:remove
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
intuitem/ciso-assistant-community#5380 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
TarteelAI/quranic-universal-library#1111 ·
维护者通常 1 天内回复
-
area:ryoku type:bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 64/100
githubnext/gh-aw-workshop#6094 ·
维护者通常 1 天内回复