From a5e45d737ecde183d95c0fafec92bfff09051a03 Mon Sep 17 00:00:00 2001 From: pitchum Date: Wed, 18 Nov 2020 11:35:20 +0100 Subject: [PATCH] Update nodeinfo2: Fix the way "active users count" is computed Previously, only users having MAM messages stored where counted. Now we count all users who have established a connexion with the server. --- nodeinfo2/update_nodeinfo | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nodeinfo2/update_nodeinfo b/nodeinfo2/update_nodeinfo index c95f7a3..9bbcaa0 100755 --- a/nodeinfo2/update_nodeinfo +++ b/nodeinfo2/update_nodeinfo @@ -45,11 +45,9 @@ per_account_storage_usage() { user_activity() { days_back=${1:-30} - sql="select count(distinct username) - from archive - where peer not like 'irc%' - and kind = 'chat' - and created_at > current_timestamp - interval '${days_back} days' + sql="select count(distinct l.username) + from last l + where to_timestamp(cast(l.seconds as int)) > current_timestamp - interval '${days_back} days' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'