adjust timeframes of purge script
This commit is contained in:
parent
7a46c57430
commit
b89246f73c
|
@ -45,7 +45,7 @@ ROOMS=`psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "selec
|
||||||
get_curl_config () {
|
get_curl_config () {
|
||||||
room=${1}
|
room=${1}
|
||||||
# Get all appsockets users from a public room that did not send any message in the past 48h
|
# Get all appsockets users from a public room that did not send any message in the past 48h
|
||||||
ASUSERS=`psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "select user_id from users_in_public_rooms u where room_id = '${room}' and user_id like '@${PREFIX}_%:pixelplanet.fun' and user_id != '${ADMINID}' and not exists ( select from events where room_id = '${room}' and sender = u.user_id and to_timestamp(received_ts/1000) > now() - interval '48 HOURS' ) and not exists ( select from user_ips where user_id = u.user_id )"`
|
ASUSERS=`psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "select user_id from users_in_public_rooms u where room_id = '${room}' and user_id like '@${PREFIX}_%:pixelplanet.fun' and user_id != '${ADMINID}' and not exists ( select from events where room_id = '${room}' and sender = u.user_id and to_timestamp(received_ts/1000) > now() - interval '4 DAYS' ) and not exists ( select from user_ips where user_id = u.user_id )"`
|
||||||
KICKURL="${MATRIXURL}/_matrix/client/v3/rooms/${room}/kick"
|
KICKURL="${MATRIXURL}/_matrix/client/v3/rooms/${room}/kick"
|
||||||
CNT=1
|
CNT=1
|
||||||
for user in ${ASUSERS}
|
for user in ${ASUSERS}
|
||||||
|
@ -71,7 +71,7 @@ do
|
||||||
# Clean event_push_actions of not-logged-in application service users
|
# Clean event_push_actions of not-logged-in application service users
|
||||||
# see https://github.com/matrix-org/synapse/issues/5569
|
# see https://github.com/matrix-org/synapse/issues/5569
|
||||||
# This command can be really slow, if it takes too long, remove the "not exists..." part and it won't care about if logged in or not
|
# This command can be really slow, if it takes too long, remove the "not exists..." part and it won't care about if logged in or not
|
||||||
time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "delete from event_push_actions u where room_id = '${room}' and user_id like '@${PREFIX}_%:pixelplanet.fun' and user_id != '${ADMINID}' and not exists ( select from user_ips where user_id = u.user_id and to_timestamp(last_seen/1000) > now() - interval '4 weeks' )"
|
time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "delete from event_push_actions u where room_id = '${room}' and user_id like '@${PREFIX}_%:pixelplanet.fun' and not exists ( select from user_ips where user_id = u.user_id and to_timestamp(last_seen/1000) > now() - interval '2 days' )"
|
||||||
echo "--Kick out inactive users from room ${room}..."
|
echo "--Kick out inactive users from room ${room}..."
|
||||||
get_curl_config "${room}" > /tmp/curlkick.tmp && curl --parallel --parallel-immediate --parallel-max 10 --config /tmp/curlkick.tmp && echo ""
|
get_curl_config "${room}" > /tmp/curlkick.tmp && curl --parallel --parallel-immediate --parallel-max 10 --config /tmp/curlkick.tmp && echo ""
|
||||||
rm /tmp/curlkick.tmp
|
rm /tmp/curlkick.tmp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user