Skip to content

Commit

Permalink
scripts: Fix deleting rooms without local users
Browse files Browse the repository at this point in the history
/_synapse/admin/v1/purge_room was removed since synapse 1.42.0
  • Loading branch information
csett86 committed Apr 9, 2022
1 parent e4e6395 commit bb53996
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/synapse-compress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ PSQL_DB=synapse

ROOMLIST=$(curl --silent --header "Authorization: Bearer $API_TOKEN" $HOST/_synapse/admin/v1/rooms?limit=$ROOMLIMIT)

ROOMS_WITHOUT_LOCAL_USERS=$(echo $ROOMLIST | jq '.rooms[] | select(.joined_local_members == 0) | .room_id')
ROOMS_WITHOUT_LOCAL_USERS=$(echo $ROOMLIST | jq --raw-output '.rooms[] | select(.joined_local_members == 0) | .room_id')

for room in $ROOMS_WITHOUT_LOCAL_USERS; do
curl --silent --header "Authorization: Bearer $API_TOKEN" --header "Content-Type: application/json" -d "{ \"room_id\": $room }" --output /dev/null $HOST/_synapse/admin/v1/purge_room
curl --silent --header "Authorization: Bearer $API_TOKEN" --header "Content-Type: application/json" -XDELETE -d "{}" --output /dev/null "$HOST/_synapse/admin/v1/rooms/$room"
done

TIMESTAMPMS30DAYS=$(date --date="-30 days" +%s000)
Expand All @@ -30,7 +30,7 @@ curl --silent --header "Authorization: Bearer $API_TOKEN" --header "Content-Type
#done

# auto state compress with "big" settings from https://gitlab.com/mb-saces/synatainer
RUST_LOG=error $HOME/rust-synapse-compress-state/target/debug/synapse_auto_compressor -c 1500 -n 300 -p postgresql://$PSQL_USER:$PSQL_PASSWORD@$PSQL_HOST/$PSQL_DB
RUST_LOG=error $HOME/rust-synapse-compress-state/target/debug/synapse_auto_compressor -c 1500 -n 300 -p "postgresql://$PSQL_USER:$PSQL_PASSWORD@$PSQL_HOST/$PSQL_DB"

# when performing stop, dependencies are stopped
monit stop synapse
Expand Down

0 comments on commit bb53996

Please sign in to comment.