fix(db): 启用冲突键排序去重并增加死锁重试机制

修改数据库管理器配置,默认启用冲突键排序去重功能,保留最大时间戳记录
增加死锁重试机制,默认重试3次,基础延迟100毫秒
添加相关测试用例验证排序去重和死锁重试功能
This commit is contained in:
2026-04-03 18:46:30 +08:00
parent 1ee0988ac6
commit a79c06d4f3
2 changed files with 64 additions and 2 deletions

View File

@@ -931,8 +931,8 @@ class DatabaseManager {
tableRef: this.config.roomStatusTable ?? 'room_status.room_status_moment',
forceOnlineStatusOnWrite: false,
forceUpdateOnConflict: false,
sortAndDedupByConflictKey: false,
deadlockRetryAttempts: 0,
sortAndDedupByConflictKey: true,
deadlockRetryAttempts: 3,
deadlockRetryBaseDelayMs: 100,
logPrefix: 'upsertRoomStatus',
});