Update serviceinfo: 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.
This commit is contained in:
parent
a5e45d737e
commit
0872c5cc08
|
@ -1,7 +1,7 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
TEMPLATE=/srv/xmpp.chapril.org/tools/serviceinfo/template-serviceinfo.json
|
TEMPLATE=/srv/xmpp.chapril.org/tools/serviceinfo/template-serviceinfo.json
|
||||||
TARGET_FILE=/srv/serviceinfo.json
|
TARGET_FILE=/srv/xmpp.chapril.org/experimental/serviceinfo.json
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cat "${TEMPLATE}" \
|
cat "${TEMPLATE}" \
|
||||||
|
@ -56,11 +56,9 @@ starttime() {
|
||||||
|
|
||||||
user_activity() {
|
user_activity() {
|
||||||
days_back=${1:-30}
|
days_back=${1:-30}
|
||||||
sql="select count(distinct username)
|
sql="select count(distinct l.username)
|
||||||
from archive
|
from last l
|
||||||
where peer not like 'irc%'
|
where to_timestamp(cast(l.seconds as int)) > current_timestamp - interval '${days_back} days'
|
||||||
and kind = 'chat'
|
|
||||||
and created_at > current_timestamp - interval '${days_back} days'
|
|
||||||
and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
|
and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
|
||||||
|
|
||||||
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
||||||
|
|
Loading…
Reference in New Issue