fix(web): remove deleted multi-inbound client from runtime regardless of shared email (#5543)

DelInboundClientByEmail gated the runtime RemoveUser/DeleteUser (and its
push-plan resolution) on !emailShared. But Xray users are keyed by inbound
tag + email, so a client attached to two inbounds left its user live in the
running Xray of every inbound where the email was still shared by a sibling
inbound, until an Xray restart.

Decouple the per-inbound runtime removal from emailShared; keep emailShared
only for preserving the shared email-keyed client_traffics/IP rows.
This commit is contained in:
MHSanaei
2026-06-24 22:43:18 +02:00
parent e2d25d0ac7
commit 896016f7f6
2 changed files with 42 additions and 3 deletions
+8 -3
View File
@@ -787,9 +787,12 @@ func (s *ClientService) DelInboundClientByEmail(inboundSvc *InboundService, inbo
delStat = traffic != nil
}
// The runtime user is scoped to this inbound's tag + email, so the push plan
// is resolved independently of emailShared — a sibling inbound still carrying
// the email must not suppress removing the user from this inbound's Xray.
var rt runtime.Runtime
var push bool
if len(email) > 0 && !emailShared && (oldInbound.NodeID != nil || needApiDel) {
if len(email) > 0 && (oldInbound.NodeID != nil || needApiDel) {
r, p, dirty, perr := inboundSvc.nodePushPlan(oldInbound)
if perr != nil {
return false, perr
@@ -828,8 +831,10 @@ func (s *ClientService) DelInboundClientByEmail(inboundSvc *InboundService, inbo
}
// Apply the runtime delete after commit — outside the serialized writer so a
// slow node call can't stall traffic accounting.
if len(email) > 0 && !emailShared {
// slow node call can't stall traffic accounting. Independent of emailShared:
// Xray users are keyed by inbound tag, so the user must be removed from this
// inbound's runtime even when the same email survives in another inbound.
if len(email) > 0 {
if oldInbound.NodeID == nil {
// Local inbound: a disabled client isn't in the running Xray, so only
// a live one (needApiDel) needs an API removal.