Parallelize initial overview sync

This commit is contained in:
OpenClaw committed 2026-03-07 16:14:57 +08:00
1 parent bba051bf14
commit 2754dada42
2 files changed
+19 -6

No files matched your search

@@ -9,6 +9,8 @@ import cn.xiaobai.openclawapp.data.RemoteOpenClawRepository
import cn.xiaobai.openclawapp.data.RepositoryFactory
import cn.xiaobai.openclawapp.data.ServerConfig
import cn.xiaobai.openclawapp.network.MobileGatewayApi
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
class OpenClawAppState(
private val preferences: AppPreferences = AppPreferences(),
@@ -106,9 +108,14 @@ class OpenClawAppState(
isSyncing = true
syncError = null
runCatching {
remote.refreshStatus()
remote.refreshAgents()
remote.refreshSessions()
coroutineScope {
val statusDeferred = async { remote.refreshStatus() }
val agentsDeferred = async { remote.refreshAgents() }
val sessionsDeferred = async { remote.refreshSessions() }
statusDeferred.await()
agentsDeferred.await()
sessionsDeferred.await()
}
val drainedText = remote.drainPendingTextQueue()
val drainedAttachments = remote.drainPendingAttachmentQueue()
preferences.saveOverviewSnapshot(remote.exportOverviewSnapshot())
@@ -130,9 +137,14 @@ class OpenClawAppState(
if (isSyncing || sendingSessionId != null) return
runCatching {
remote.refreshStatus()
remote.refreshAgents()
remote.refreshSessions()
coroutineScope {
val statusDeferred = async { remote.refreshStatus() }
val agentsDeferred = async { remote.refreshAgents() }
val sessionsDeferred = async { remote.refreshSessions() }
statusDeferred.await()
agentsDeferred.await()
sessionsDeferred.await()
}
preferences.saveOverviewSnapshot(remote.exportOverviewSnapshot())
persistPendingSendQueue(remote)
isShowingCachedData = false
+1
View File
@@ -445,3 +445,4 @@ Android/iOS App
- 2026-03-07:补了一层附件上传响应 DTO 兼容:客户端 `UploadAttachmentResponseDto` 现在同时接受 `accepted/accept`、`fileName/filename`、`sizeBytes/sizebytes`、camelCase/snake_case 等字段名,先兜住线上回包字段不一致导致的反序列化失败。
- 2026-03-07:收口一处“最后一条一直转圈”的本地状态残留:文本消息被服务端接受后,如果当前会话已经没有待发文本,就会立刻清掉本地 `thinking` 占位消息,避免附件已完成但时间线尾部仍像一直在生成回复。
- 2026-03-07:默认收起成功的工具调用噪音:聊天页时间线不再直接展示普通 `toolCall` 和成功 `toolResult`,优先保留用户/助手正文、附件与关键错误;工具失败仍继续显示,避免用户正常发一条消息却被一串内部工具事件刷屏。
- 2026-03-07:首屏远程同步提速第一轮:App 端把 `status / agents / sessions` 从串行改成并行;BFF 端 `list_sessions()` 去掉每条 session 再补 `chat.history(limit=1)` 的 N+1 回查,首页先快速拿列表,避免刚打开就被会话摘要回查拖慢。