mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-12 00:23:10 -06:00
Evacuate room before purging
This commit is contained in:
parent
753971dc9b
commit
b2f177689b
|
|
@ -68,7 +68,7 @@ This endpoint instructs Dendrite to immediately query `/devices/{userID}` on a f
|
|||
|
||||
## POST `/_dendrite/admin/purgeRoom/{roomID}`
|
||||
|
||||
This endpoint instructs Dendrite to remove the given room from its database. It does **NOT** remove media files. Depending on the size of the room, this may take a while. Will return an empty JSON once other components were instructed to delete the room.
|
||||
This endpoint instructs Dendrite to remove the given room from its database. Before doing so, it will evacuate all local users from the room. It does **NOT** remove media files. Depending on the size of the room, this may take a while. Will return an empty JSON once other components were instructed to delete the room.
|
||||
|
||||
## POST `/_synapse/admin/v1/send_server_notice`
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,20 @@ func (r *Admin) PerformAdminPurgeRoom(
|
|||
return nil
|
||||
}
|
||||
|
||||
logrus.WithField("room_id", req.RoomID).Warn("Purging room from roomserver")
|
||||
evacResp := &api.PerformAdminEvacuateRoomResponse{}
|
||||
if err := r.PerformAdminEvacuateRoom(ctx, &api.PerformAdminEvacuateRoomRequest{RoomID: req.RoomID}, evacResp); err != nil {
|
||||
res.Error = &api.PerformError{
|
||||
Code: api.PerformErrorBadRequest,
|
||||
Msg: fmt.Sprintf("failed to evacuate room: %s", err),
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"room_id": req.RoomID,
|
||||
"evacuated_users": len(evacResp.Affected),
|
||||
}).Warn("Evacuated room, purging room from roomserver now")
|
||||
|
||||
if err := r.DB.PurgeRoom(ctx, req.RoomID); err != nil {
|
||||
logrus.WithField("room_id", req.RoomID).WithError(err).Warn("Failed to purge room from roomserver")
|
||||
res.Error = &api.PerformError{
|
||||
|
|
|
|||
Loading…
Reference in a new issue