mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
fix:
This commit is contained in:
parent
031a2f6668
commit
ebb4c483d0
2 changed files with 5 additions and 5 deletions
|
|
@ -35,7 +35,7 @@ func (j *XrayTrafficJob) Run() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err, needRestart0, clientsDisabled := j.inboundService.AddTraffic(traffics, clientTraffics)
|
needRestart0, clientsDisabled, err := j.inboundService.AddTraffic(traffics, clientTraffics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warning("add inbound traffic failed:", err)
|
logger.Warning("add inbound traffic failed:", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1317,7 +1317,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin
|
||||||
return needRestart, tx.Save(oldInbound).Error
|
return needRestart, tx.Save(oldInbound).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *InboundService) AddTraffic(inboundTraffics []*xray.Traffic, clientTraffics []*xray.ClientTraffic) (error, bool, bool) {
|
func (s *InboundService) AddTraffic(inboundTraffics []*xray.Traffic, clientTraffics []*xray.ClientTraffic) (bool, bool, error) {
|
||||||
var err error
|
var err error
|
||||||
db := database.GetDB()
|
db := database.GetDB()
|
||||||
tx := db.Begin()
|
tx := db.Begin()
|
||||||
|
|
@ -1331,11 +1331,11 @@ func (s *InboundService) AddTraffic(inboundTraffics []*xray.Traffic, clientTraff
|
||||||
}()
|
}()
|
||||||
err = s.addInboundTraffic(tx, inboundTraffics)
|
err = s.addInboundTraffic(tx, inboundTraffics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err, false, false
|
return false, false, err
|
||||||
}
|
}
|
||||||
err = s.addClientTraffic(tx, clientTraffics)
|
err = s.addClientTraffic(tx, clientTraffics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err, false, false
|
return false, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
needRestart0, count, err := s.autoRenewClients(tx)
|
needRestart0, count, err := s.autoRenewClients(tx)
|
||||||
|
|
@ -1360,7 +1360,7 @@ func (s *InboundService) AddTraffic(inboundTraffics []*xray.Traffic, clientTraff
|
||||||
} else if count > 0 {
|
} else if count > 0 {
|
||||||
logger.Debugf("%v inbounds disabled", count)
|
logger.Debugf("%v inbounds disabled", count)
|
||||||
}
|
}
|
||||||
return nil, (needRestart0 || needRestart1 || needRestart2), disabledClientsCount > 0
|
return needRestart0 || needRestart1 || needRestart2, disabledClientsCount > 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *InboundService) addInboundTraffic(tx *gorm.DB, traffics []*xray.Traffic) error {
|
func (s *InboundService) addInboundTraffic(tx *gorm.DB, traffics []*xray.Traffic) error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue