mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-18 01:00:59 +00:00
fix(nodes): clean up orphaned client_inbounds on node inbound removal
When a remote node disconnects or one of its inbounds vanishes from the traffic snapshot, setRemoteTrafficLocked deleted the central inbound row but left the client_inbounds join rows behind. Affected clients ended up linked to hundreds of phantom inbounds, and editing one then failed with "record not found" / "Load Old Data Error" because Update aborted on the first GetInbound miss. - Detach client_inbounds rows when deleting a vanished node inbound - Prune stale links during client Update instead of aborting the save - Drop orphaned client_inbounds rows on startup to heal existing DBs Closes #4636
This commit is contained in:
@@ -1432,6 +1432,9 @@ func (s *InboundService) setRemoteTrafficLocked(nodeID int, snap *runtime.Traffi
|
||||
Delete(&xray.ClientTraffic{}).Error; err != nil {
|
||||
return false, err
|
||||
}
|
||||
if err := s.clientService.DetachInbound(tx, c.Id); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if err := tx.Where("id = ?", c.Id).
|
||||
Delete(&model.Inbound{}).Error; err != nil {
|
||||
return false, err
|
||||
|
||||
Reference in New Issue
Block a user