fix restart inbounds after commit db changes
This commit is contained in:
@@ -307,7 +307,7 @@ func (s *ClientService) DepleteClients() error {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
if len(inboundIds) > 0 && corePtr.IsRunning() {
|
if len(inboundIds) > 0 && corePtr.IsRunning() {
|
||||||
err1 := s.InboundService.RestartInbounds(tx, inboundIds)
|
err1 := s.InboundService.RestartInbounds(db, inboundIds)
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
logger.Error("unable to restart inbounds: ", err1)
|
logger.Error("unable to restart inbounds: ", err1)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-11
@@ -127,6 +127,16 @@ func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initU
|
|||||||
defer func() {
|
defer func() {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
|
if len(inboundIds) > 0 && corePtr.IsRunning() {
|
||||||
|
err1 := s.InboundService.RestartInbounds(db, inboundIds)
|
||||||
|
if err1 != nil {
|
||||||
|
logger.Error("unable to restart inbounds: ", err1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Try to start core if it is not running
|
||||||
|
if !corePtr.IsRunning() {
|
||||||
|
s.StartCore("")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
}
|
}
|
||||||
@@ -214,17 +224,6 @@ func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initU
|
|||||||
objs = append(objs, "inbounds")
|
objs = append(objs, "inbounds")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(inboundIds) > 0 && corePtr.IsRunning() {
|
|
||||||
err1 := s.InboundService.RestartInbounds(tx, inboundIds)
|
|
||||||
if err1 != nil {
|
|
||||||
logger.Error("unable to restart inbounds: ", err1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Try to start core if it is not running
|
|
||||||
if !corePtr.IsRunning() {
|
|
||||||
s.StartCore("")
|
|
||||||
}
|
|
||||||
|
|
||||||
return objs, nil
|
return objs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user