mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-13 16:16:06 +00:00
fix(node): never sweep a node's inbounds before their first adoption
Adding a node imports nothing; its pre-existing inbounds only become central rows on the first clean traffic-sync tick. But any save of the node (switching sync mode, picking tags after "Load inbounds from node") marks it config-dirty, and the next tick then ran ReconcileNode before that first adoption: with zero central rows the delete sweep saw every remote tag as undesired and destroyed the node's real inbounds - in "all" mode all of them - disconnecting live clients with no confirmation, and the master then reported "record not found". Track the first completed clean sync in nodes.inbounds_adopted_at and skip the sweep (pushes still run) until it is set, so "absent locally" can no longer be conflated with "deleted on the master". A node that has synced before still sweeps normally, including the offline last-inbound-deleted case. Existing nodes are seeded as adopted on upgrade to keep their behavior unchanged. Closes #5898
This commit is contained in:
@@ -129,6 +129,11 @@ func (s *InboundService) ReconcileNode(ctx context.Context, rt *runtime.Remote,
|
||||
errs = append(errs, fmt.Errorf("reconcile inbound %q: %w", ib.Tag, err))
|
||||
}
|
||||
}
|
||||
// Before the first clean sync adopts the node's inbounds, "absent locally"
|
||||
// means "not imported yet" — sweeping now would wipe the node at onboarding.
|
||||
if n.InboundsAdoptedAt == 0 {
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
// In "selected" sync mode the panel only manages the selected tags: the
|
||||
// rest were never imported, so their absence from the local DB must not
|
||||
// delete them from the node. Only a selected tag missing locally (the
|
||||
|
||||
Reference in New Issue
Block a user