mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-09 23:23:10 -06:00
Set max_age for roomserver input stream to avoid excessive interior deletes
This commit is contained in:
parent
c08c7405db
commit
781b52768c
|
|
@ -125,15 +125,16 @@ func setupNATS(process *process.ProcessContext, cfg *config.JetStream, nc *natsc
|
||||||
// with the subject "Foo", "Foo.Bar" or "Foo.Bar.Baz" etc.
|
// with the subject "Foo", "Foo.Bar" or "Foo.Bar.Baz" etc.
|
||||||
subjects = []string{name, name + ".>"}
|
subjects = []string{name, name + ".>"}
|
||||||
}
|
}
|
||||||
if info != nil {
|
if info != nil && !reflect.DeepEqual(info.Config, stream) {
|
||||||
switch {
|
// If the stream config doesn't match what we expect, try to update
|
||||||
case !reflect.DeepEqual(info.Config.Subjects, subjects):
|
// it. If that doesn't work then try to blow it away and we'll then
|
||||||
fallthrough
|
// recreate it in the next section.
|
||||||
case info.Config.Retention != stream.Retention:
|
if info, err = s.UpdateStream(stream); err != nil {
|
||||||
fallthrough
|
logrus.WithError(err).Warnf("Unable to update stream %q, recreating...", name)
|
||||||
case info.Config.Storage != stream.Storage:
|
// We failed to update the stream, this is a last attempt to get
|
||||||
|
// things working but may result in data loss.
|
||||||
if err = s.DeleteStream(name); err != nil {
|
if err = s.DeleteStream(name); err != nil {
|
||||||
logrus.WithError(err).Fatal("Unable to delete stream")
|
logrus.WithError(err).Fatalf("Unable to delete stream %q", name)
|
||||||
}
|
}
|
||||||
info = nil
|
info = nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ var streams = []*nats.StreamConfig{
|
||||||
Name: InputRoomEvent,
|
Name: InputRoomEvent,
|
||||||
Retention: nats.InterestPolicy,
|
Retention: nats.InterestPolicy,
|
||||||
Storage: nats.FileStorage,
|
Storage: nats.FileStorage,
|
||||||
|
MaxAge: time.Hour * 24,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: InputDeviceListUpdate,
|
Name: InputDeviceListUpdate,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue