perf(core): implement efficient bulk user deletion
Revamps the entire user deletion process to resolve critical performance bottlenecks that caused the web panel and database to freeze when removing multiple users. - **Backend:** Core scripts (`kickuser.py`, `remove_user.py`) and the database layer are re-engineered to handle multiple users in a single, efficient batch operation using MongoDB's `delete_many`. - **API:** A new `POST /api/v1/users/bulk-delete` endpoint is introduced for batch removals. The existing single-user `DELETE` endpoint is fixed to align with the new bulk logic. - **Frontend:** The Users page now intelligently calls the bulk API when multiple users are selected, drastically improving UI responsiveness and reducing server load.
This commit is contained in:
@ -35,6 +35,9 @@ class Database:
|
||||
def delete_user(self, username):
|
||||
return self.collection.delete_one({"_id": username.lower()})
|
||||
|
||||
def delete_users(self, usernames):
|
||||
return self.collection.delete_many({"_id": {"$in": usernames}})
|
||||
|
||||
try:
|
||||
db = Database()
|
||||
except pymongo.errors.ConnectionFailure:
|
||||
|
||||
Reference in New Issue
Block a user