mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-15 09:06:07 +00:00
fix(node): fully delete clients on nodes instead of only detaching them
Deleting a client on the master propagated to nodes via the detach endpoint, which removes the client from that one inbound's settings but deliberately keeps the client record. The node ended up with an orphaned record that kept showing in its Clients view; the master and node could never converge on a delete. Full-delete and detach intent now travel separately: the Runtime interface gains DeleteClient, which on Remote hits the node's panel/api/clients/del endpoint (record, attachments, traffic; repeat calls for a client on several inbounds of the same node are swallowed as idempotent "not found"). Delete/DeleteByEmail/BulkDelete use it for node inbounds, while Detach/BulkDetach keep the inbound-scoped detach RPC so removing a client from one inbound never wipes it node-wide (the #5543 guarantee is preserved and covered by tests). Bulk deletes above the fold threshold still converge membership via reconcile; their leftover node records can be cleaned with the node's delete-orphans action. Closes #5797
This commit is contained in:
@@ -16,9 +16,10 @@ import (
|
||||
// fakeNodeRuntime is a runtime.Runtime stub that counts the per-client dispatch
|
||||
// calls so a test can assert a bulk op does NOT stream one RPC per client.
|
||||
type fakeNodeRuntime struct {
|
||||
addClient atomic.Int32
|
||||
deleteUser atomic.Int32
|
||||
updateUser atomic.Int32
|
||||
addClient atomic.Int32
|
||||
deleteUser atomic.Int32
|
||||
deleteClient atomic.Int32
|
||||
updateUser atomic.Int32
|
||||
}
|
||||
|
||||
func (f *fakeNodeRuntime) Name() string { return "fake-node" }
|
||||
@@ -40,6 +41,11 @@ func (f *fakeNodeRuntime) DeleteUser(context.Context, *model.Inbound, string) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *fakeNodeRuntime) DeleteClient(context.Context, string) error {
|
||||
f.deleteClient.Add(1)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *fakeNodeRuntime) AddClient(context.Context, *model.Inbound, model.Client) error {
|
||||
f.addClient.Add(1)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user