Skip to content

Commit

Permalink
use set
Browse files Browse the repository at this point in the history
  • Loading branch information
houshmand-2005 authored Jun 1, 2024
1 parent 1e2458e commit ff426cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utils/check_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ async def check_users_usage(panel_data: PanelType):
except_users = config_data.get("EXCEPT_USERS", [])
special_limit = config_data.get("SPECIAL_LIMIT", {})
limit_number = config_data["GENERAL_LIMIT"]
for user_name, data in all_users_log.items():
for user_name, user_ip in all_users_log.items():
if user_name not in except_users:
user_limit_number = int(special_limit.get(user_name, limit_number))
if len(data) > user_limit_number:
if len(set(user_ip)) > user_limit_number:
message = (
f"User {user_name} has {str(len(data))} active ips. {str(data)}"
f"User {user_name} has {str(len(set(user_ip)))}"
+ f" active ips. {str(set(user_ip))}"
)
logger.warning(message)
await send_logs(str("<b>Warning: </b>" + message))
Expand Down

0 comments on commit ff426cd

Please sign in to comment.