siyuan/kernel
Jeffrey Chen 64514b4fab
Improve the performance of the getCloudUser interface to resolve the lag issue during startup (#16647)
问题:
- /api/setting/getCloudUser 接口在启动时卡顿数百毫秒
- 根本原因:GetUser()、SetUser() 和 Conf.Save() 使用同一个锁,存在锁竞争

解决方案:
1. 将 GetUser() 改为使用读锁(RLock),允许并发读取
2. 将用户数据与配置数据分离,使用独立的 userLock 锁
   - m 锁:保护配置数据的读写(Conf.Save() 使用)
   - userLock 锁:保护用户数据的读写(GetUser() 和 SetUser() 使用)
3. 优化 RefreshUser 函数,先尝试从内存获取用户,避免不必要的文件读取

相关文件:
- kernel/model/conf.go: 添加 userLock,修改 GetUser/SetUser 使用独立锁
- kernel/model/cloud_service.go: 优化 RefreshUser 逻辑
2025-12-22 17:30:40 +08:00
..
api 🎨 Fix https://github.com/siyuan-note/siyuan/issues/16664 2025-12-22 16:52:27 +08:00
av 🎨 Fix https://github.com/siyuan-note/siyuan/issues/16667 2025-12-22 17:10:47 +08:00
bazaar 🎨 Improve the fallback logic of the marketplace (#16612) 2025-12-17 07:43:05 +08:00
cache 🎨 Improve detection of duplicate insertion of assets https://github.com/siyuan-note/siyuan/issues/16220 2025-10-28 11:01:53 +08:00
cmd
conf 🎨 Supports setting the spell check language on desktop https://github.com/siyuan-note/siyuan/issues/16524 2025-12-08 17:47:46 +08:00
filesys 🎨 Improve callout block https://github.com/siyuan-note/siyuan/issues/16607 2025-12-20 12:31:28 +08:00
harmony 🐛 Data indexing is abnormal after switching workspaces on mobile https://github.com/siyuan-note/siyuan/issues/16646 2025-12-20 17:26:00 +08:00
job 🎨 Improve the status bar index creation information prompt https://github.com/siyuan-note/siyuan/issues/15390 2025-07-30 15:46:09 +08:00
mobile 🐛 Data indexing is abnormal after switching workspaces on mobile https://github.com/siyuan-note/siyuan/issues/16646 2025-12-20 17:26:00 +08:00
model Improve the performance of the getCloudUser interface to resolve the lag issue during startup (#16647) 2025-12-22 17:30:40 +08:00
resource
search 🎨 Improve tag escaping 2025-04-23 22:17:06 +08:00
server 🎨 Improve exit 2025-12-09 12:20:57 +08:00
sql 🎨 Improve callout block https://github.com/siyuan-note/siyuan/issues/16607 https://ld246.com/article/1766149237514 2025-12-21 11:38:14 +08:00
task 🎨 Support setting status bar message switch https://github.com/siyuan-note/siyuan/issues/16236 2025-11-13 18:28:42 +08:00
testdata 🎨 Support searching PDF asset content https://github.com/siyuan-note/siyuan/pull/8985 2023-08-17 11:58:54 +08:00
treenode Improve performance for large-scale block deletion/insertion https://github.com/siyuan-note/siyuan/issues/16644 2025-12-21 18:29:10 +08:00
util 🐛 Fix Built-in Pandoc is not working on Unix-like 2025-12-19 20:13:57 +08:00
entrypoint.sh 🎨 Support SIYUAN_WORKSPACE_PATH in Docker (#14286) 2025-03-05 17:24:27 +08:00
go.mod ⬆️ Upgrade kernel deps 2025-12-22 16:48:39 +08:00
go.sum ⬆️ Upgrade kernel deps 2025-12-22 16:48:39 +08:00
main.go Improve system font loading https://github.com/siyuan-note/siyuan/issues/13356 2024-12-05 09:01:51 +08:00
versioninfo.json 🎨 Improve kernel program meta props 2025-10-04 14:15:03 +08:00