summary refs log tree commit diff
path: root/synapse/storage/databases/main
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2020-09-29 13:11:02 +0100
committerGitHub <noreply@github.com>2020-09-29 13:11:02 +0100
commit8676d8ab2e5667d7c12774effc64b3ab99344a8d (patch)
treee5126e3c5918240a55358a1f8ddf77fa295e2938 /synapse/storage/databases/main
parentOnly assert valid next_link params when provided (#8417) (diff)
downloadsynapse-8676d8ab2e5667d7c12774effc64b3ab99344a8d.tar.xz
Filter out appservices from mau count (#8404)
This is an attempt to fix #8403.
Diffstat (limited to 'synapse/storage/databases/main')
-rw-r--r--synapse/storage/databases/main/monthly_active_users.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/monthly_active_users.py b/synapse/storage/databases/main/monthly_active_users.py

index e0cedd1aac..e93aad33cd 100644 --- a/synapse/storage/databases/main/monthly_active_users.py +++ b/synapse/storage/databases/main/monthly_active_users.py
@@ -41,7 +41,14 @@ class MonthlyActiveUsersWorkerStore(SQLBaseStore): """ def _count_users(txn): - sql = "SELECT COALESCE(count(*), 0) FROM monthly_active_users" + # Exclude app service users + sql = """ + SELECT COALESCE(count(*), 0) + FROM monthly_active_users + LEFT JOIN users + ON monthly_active_users.user_id=users.name + WHERE (users.appservice_id IS NULL OR users.appservice_id = ''); + """ txn.execute(sql) (count,) = txn.fetchone() return count