Skip to content

Commit

Permalink
Revert "Chore: remove MASTER_SERVER_USAGE_RATIO"
Browse files Browse the repository at this point in the history
This reverts commit a287147.

Revert "Merge pull request #1284 from erfjab/mainserverusage"

This reverts commit d4e2be5, reversing
changes made to c2c98b7.
  • Loading branch information
M03ED committed Sep 2, 2024
1 parent a287147 commit 8695b8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
23 changes: 10 additions & 13 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,22 @@ UVICORN_PORT = 8000

### Use negative values to disable auto-delete by default
# USERS_AUTODELETE_DAYS = -1
# USER_AUTODELETE_INCLUDE_LIMITED_ACCOUNTS = True
# USER_AUTODELETE_INCLUDE_LIMITED_ACCOUNTS = false

## Customize all notifications
# NOTIFY_STATUS_CHANGE = False
# NOTIFY_USER_CREATED = False
# NOTIFY_USER_UPDATED = False
# NOTIFY_USER_DELETED = False
# NOTIFY_USER_DATA_USED_RESET = False
# NOTIFY_USER_SUB_REVOKED = False
# NOTIFY_IF_DATA_USAGE_PERCENT_REACHED = False
# NOTIFY_IF_DAYS_LEF_REACHED = False
# NOTIFY_LOGIN = False
# NOTIFY_STATUS_CHANGE = True
# NOTIFY_USER_CREATED = True
# NOTIFY_USER_UPDATED = True
# NOTIFY_USER_DELETED = True
# NOTIFY_USER_DATA_USED_RESET = True
# NOTIFY_USER_SUB_REVOKED = True
# NOTIFY_IF_DATA_USAGE_PERCENT_REACHED = True
# NOTIFY_IF_DAYS_LEF_REACHED = True
# NOTIFY_LOGIN = True

## Whitelist of IPs/hosts to disable login notifications
# LOGIN_WHITE_LIST = '1.1.1.1,sub.domain.com,127.0.0.1'

## Main Server Usege Ratio
# MAIN_SERVER_USAGE_RATIO = 1.0

### for developers
# DOCS=True
# DEBUG=True
Expand Down
5 changes: 2 additions & 3 deletions app/jobs/record_usages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from app.db.models import NodeUsage, NodeUserUsage, System, User
from config import (DISABLE_RECORDING_NODE_USAGE,
JOB_RECORD_NODE_USAGES_INTERVAL,
JOB_RECORD_USER_USAGES_INTERVAL,
MASTER_SERVER_USAGE_RATIO)
JOB_RECORD_USER_USAGES_INTERVAL)
from xray_api import XRay as XRayAPI
from xray_api import exc as xray_exc

Expand Down Expand Up @@ -126,7 +125,7 @@ def get_outbounds_stats(api: XRayAPI):

def record_user_usages():
api_instances = {None: xray.api}
usage_coefficient = {None: MASTER_SERVER_USAGE_RATIO} # default usage coefficient for the main api instance
usage_coefficient = {None: 1} # default usage coefficient for the main api instance

for node_id, node in list(xray.nodes.items()):
if node.connected and node.started:
Expand Down
1 change: 0 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@

EXTERNAL_CONFIG = config("EXTERNAL_CONFIG", default="", cast=str)
LOGIN_WHITE_LIST = [ip.strip() for ip in config("LOGIN_WHITE_LIST", default="", cast=str).split(",") if ip.strip()]
MASTER_SERVER_USAGE_RATIO = config("MASTER_SERVER_USAGE_RATIO", default=1.0, cast=float)

USE_CUSTOM_JSON_DEFAULT = config("USE_CUSTOM_JSON_DEFAULT", default=False, cast=bool)
USE_CUSTOM_JSON_FOR_V2RAYN = config("USE_CUSTOM_JSON_FOR_V2RAYN", default=False, cast=bool)
Expand Down

0 comments on commit 8695b8c

Please sign in to comment.