修复更新节点时并发导致的分配失败问题

This commit is contained in:
2025-08-16 18:38:29 +08:00
parent 83f112c260
commit b6731f8442
3 changed files with 9 additions and 16 deletions

View File

@@ -20,7 +20,7 @@ func FindCitiesWithEdgesCount(tx *gorm.DB) ([]model.City, error) {
model.City
EdgesCount int `gorm:"column:edges_count"`
}
err := tx.Debug().
err := tx.
Select("cityhash.*, COUNT(edge.id) AS edges_count").
Joins("LEFT JOIN edge ON edge.city_id = cityhash.id").
Where("cityhash.label IS NOT NULL").