Ignore ephemeral

This commit is contained in:
Neil Alexander 2022-10-14 12:29:22 +01:00
parent cce0567289
commit 54ce7b5c9a
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -194,12 +194,16 @@ func (r *Inputer) Start() error {
// Make sure that we match the expected inactivity threshold.
stream := r.Cfg.Matrix.JetStream.Prefixed(jetstream.InputRoomEvent)
for consumer := range r.JetStream.Consumers(stream) {
if consumer.Config.InactiveThreshold == inactiveThreshold {
continue
}
consumer.Config.InactiveThreshold = inactiveThreshold
if _, cerr := r.JetStream.UpdateConsumer(stream, &consumer.Config); cerr != nil {
logrus.WithError(cerr).Warnf("Failed to update inactive threshold on consumer %q", consumer.Name)
switch {
case consumer.Config.Durable == "":
continue // Ignore ephemeral consumers
case consumer.Config.InactiveThreshold == inactiveThreshold:
continue // Ignore consumers that already have the correct threshold
default:
consumer.Config.InactiveThreshold = inactiveThreshold
if _, cerr := r.JetStream.UpdateConsumer(stream, &consumer.Config); cerr != nil {
logrus.WithError(cerr).Warnf("Failed to update inactive threshold on consumer %q", consumer.Name)
}
}
}