Skip to content

Commit

Permalink
fix(admin): record admin usage (#1496)
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadAshouri authored Dec 7, 2024
1 parent c614b4f commit 4ba7a0c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/jobs/record_usages.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ def record_user_usages():

safe_execute(db, stmt, users_usage)

admin_data = [{"admin_id": admin_id, "value": value} for admin_id, value in admin_usage.items()]
if admin_data:
admin_update_stmt = update(Admin). \
where(Admin.id == bindparam('admin_id')). \
values(users_usage=Admin.users_usage + bindparam('value'))
safe_execute(db, admin_update_stmt, admin_data)

if DISABLE_RECORDING_NODE_USAGE:
return

admin_data = [{"admin_id": admin_id, "value": value} for admin_id, value in admin_usage.items()]
if admin_data:
admin_update_stmt = update(Admin). \
where(Admin.id == bindparam('admin_id')). \
values(users_usage=Admin.users_usage + bindparam('value'))
safe_execute(db, admin_update_stmt, admin_data)

for node_id, params in api_params.items():
record_user_stats(params, node_id, usage_coefficient[node_id])

Expand Down

0 comments on commit 4ba7a0c

Please sign in to comment.