mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-03 11:45:04 +03:00
fix(clients): purge depleted clients by their exact usage key
DelDepleted turned the emails of depleted usage rows into client identities through BulkDelete, which trims each email for request bodies. A depleted row keyed by a padded email, which a node's stats could store and which belongs to no client, therefore resolved to the healthy client it resembled and deleted it. Rows whose key carries surrounding white space name no client and are skipped.
This commit is contained in:
@@ -1533,8 +1533,9 @@ func (s *ClientService) DelDepleted(inboundSvc *InboundService) (int, bool, erro
|
||||
|
||||
seen := make(map[string]struct{}, len(rows))
|
||||
emails := make([]string, 0, len(rows))
|
||||
// BulkDelete trims each email, so a padded usage row would resolve to the client it resembles.
|
||||
for _, r := range rows {
|
||||
if r.Email == "" {
|
||||
if r.Email == "" || r.Email != strings.TrimSpace(r.Email) {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[r.Email]; ok {
|
||||
|
||||
Reference in New Issue
Block a user