mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 10:33:11 -06:00
Some maintenance
This commit is contained in:
parent
783012a066
commit
ba0ebb115d
|
|
@ -3,6 +3,7 @@ package routing
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
|
@ -231,6 +232,12 @@ func AdminDownloadState(req *http.Request, device *api.Device, rsAPI roomserverA
|
|||
}
|
||||
}
|
||||
if err = rsAPI.PerformAdminDownloadState(req.Context(), roomID, device.UserID, spec.ServerName(serverName)); err != nil {
|
||||
if errors.Is(err, eventutil.ErrRoomNoExists) {
|
||||
return util.JSONResponse{
|
||||
Code: 200,
|
||||
JSON: jsonerror.NotFound(eventutil.ErrRoomNoExists.Error()),
|
||||
}
|
||||
}
|
||||
logrus.WithError(err).WithFields(logrus.Fields{
|
||||
"userID": device.UserID,
|
||||
"serverName": serverName,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ type Admin struct {
|
|||
Leaver *Leaver
|
||||
}
|
||||
|
||||
// PerformEvacuateRoom will remove all local users from the given room.
|
||||
// PerformAdminEvacuateRoom will remove all local users from the given room.
|
||||
func (r *Admin) PerformAdminEvacuateRoom(
|
||||
ctx context.Context,
|
||||
roomID string,
|
||||
|
|
@ -139,6 +139,7 @@ func (r *Admin) PerformAdminEvacuateRoom(
|
|||
return affected, err
|
||||
}
|
||||
|
||||
// PerformAdminEvacuateUser will remove the given user from all rooms.
|
||||
func (r *Admin) PerformAdminEvacuateUser(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
|
|
@ -184,6 +185,7 @@ func (r *Admin) PerformAdminEvacuateUser(
|
|||
return affected, nil
|
||||
}
|
||||
|
||||
// PerformAdminPurgeRoom removes all traces for the given room from the database.
|
||||
func (r *Admin) PerformAdminPurgeRoom(
|
||||
ctx context.Context,
|
||||
roomID string,
|
||||
|
|
@ -193,6 +195,12 @@ func (r *Admin) PerformAdminPurgeRoom(
|
|||
return err
|
||||
}
|
||||
|
||||
// Evacuate the room before purging it from the database
|
||||
if _, err := r.PerformAdminEvacuateRoom(ctx, roomID); err != nil {
|
||||
logrus.WithField("room_id", roomID).WithError(err).Warn("Failed to evacuate room before purging")
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.WithField("room_id", roomID).Warn("Purging room from roomserver")
|
||||
if err := r.DB.PurgeRoom(ctx, roomID); err != nil {
|
||||
logrus.WithField("room_id", roomID).WithError(err).Warn("Failed to purge room from roomserver")
|
||||
|
|
|
|||
Loading…
Reference in a new issue