fix(service): run inbound deletes and depleted-client purges on the serial traffic writer (#6912)

Inbound and traffic writes are serialised on one goroutine because the traffic
poll locks inbounds then client_traffics while an admin mutation does the
reverse, which Postgres aborts as a deadlock (40P01). Deleting an inbound and
purging depleted clients still opened their own transactions, so they could
deadlock the poll, and a delete committing between a concurrent edit's read
and its Save let GORM's Save fall back to CREATE and resurrect the inbound.
Both now go through runSerializedTx like every other inbound write.
This commit is contained in:
25f2002654
2026-10-24 08:36:03 +05:30
committed by GitHub
parent 5a135d2adb
commit 9f0f2b3802
3 changed files with 125 additions and 3 deletions
+1 -1
View File
@@ -1651,7 +1651,7 @@ func (s *InboundService) delInbound(id int) (bool, func(), error) {
logger.Debug("DelInbound: inbound not found, id:", id)
}
if err := db.Transaction(func(tx *gorm.DB) error {
if err := runSerializedTx(func(tx *gorm.DB) error {
if err := s.clientService.DetachInbound(tx, id); err != nil {
return err
}