mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-27 08:41:57 -06:00
Let the roomserver work first
This commit is contained in:
parent
c1d6e18152
commit
b7258dcc00
|
@ -246,21 +246,6 @@ func (r *Admin) PerformAdminPurgeRoom(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.Inputer.OutputProducer.ProduceRoomEvents(req.RoomID, []api.OutputEvent{
|
|
||||||
{
|
|
||||||
Type: api.OutputTypePurgeRoom,
|
|
||||||
PurgeRoom: &api.OutputPurgeRoom{
|
|
||||||
RoomID: req.RoomID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}); err != nil {
|
|
||||||
res.Error = &api.PerformError{
|
|
||||||
Code: api.PerformErrorBadRequest,
|
|
||||||
Msg: err.Error(),
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
logrus.WithField("room_id", req.RoomID).Warn("Purging room from roomserver")
|
logrus.WithField("room_id", req.RoomID).Warn("Purging room from roomserver")
|
||||||
if err := r.DB.PurgeRoom(ctx, req.RoomID); err != nil {
|
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")
|
logrus.WithField("room_id", req.RoomID).WithError(err).Warn("Failed to purge room from roomserver")
|
||||||
|
@ -272,5 +257,12 @@ func (r *Admin) PerformAdminPurgeRoom(
|
||||||
logrus.WithField("room_id", req.RoomID).Warn("Room purged from roomserver")
|
logrus.WithField("room_id", req.RoomID).Warn("Room purged from roomserver")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return r.Inputer.OutputProducer.ProduceRoomEvents(req.RoomID, []api.OutputEvent{
|
||||||
|
{
|
||||||
|
Type: api.OutputTypePurgeRoom,
|
||||||
|
PurgeRoom: &api.OutputPurgeRoom{
|
||||||
|
RoomID: req.RoomID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1362,6 +1362,9 @@ func (d *Database) PurgeRoom(ctx context.Context, roomID string) error {
|
||||||
return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||||
roomNID, err := d.RoomsTable.SelectRoomNIDForUpdate(ctx, txn, roomID)
|
roomNID, err := d.RoomsTable.SelectRoomNIDForUpdate(ctx, txn, roomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return fmt.Errorf("failed to lock the room: %w", err)
|
return fmt.Errorf("failed to lock the room: %w", err)
|
||||||
}
|
}
|
||||||
if err := d.Purge.PurgeStateBlocks(ctx, txn, roomNID); err != nil {
|
if err := d.Purge.PurgeStateBlocks(ctx, txn, roomNID); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue