fix(domain): WavelogQueue.updateGridsquare 添加同步锁

问题:updateGridsquare 是唯一没有 @Synchronized 的修改方法,与 add() 并发(LogTab 主线程 add + 后台协程 updateGridsquare)会触发 read-modify-write 竞态,导致新 QSO 丢失。
修复:给 updateGridsquare 加 @Synchronized,与其他修改方法保持一致。
影响:消除数据丢失风险。
This commit is contained in:
mckero committed 2026-08-14 09:19:41 +00:00
1 parent 082e0c5bff
commit d749c5ab48
1 file changed
+1
@@ -81,6 +81,7 @@ class WavelogQueue(private val store: IWavelogQueueStore) {
} }
/** Update a QSO's counterpart grid (async backfill from the QRZ scraper, 4.5.5) */ /** Update a QSO's counterpart grid (async backfill from the QRZ scraper, 4.5.5) */
@Synchronized
fun updateGridsquare(id: String, grid: String) { fun updateGridsquare(id: String, grid: String) {
save(all().map { if (it.id == id) it.copy(gridsquare = grid) else it }) save(all().map { if (it.id == id) it.copy(gridsquare = grid) else it })
} }