Android: `EditorService` does disk and SSL work on the caller's thread
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 76
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信