From f7cfa24027258873cefb41a7f7818bc43b86ad75 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Fri, 4 Jun 2021 20:23:25 +0200 Subject: [PATCH] Add missing error check Keep typing events for at least one minute --- setup/kafka/kafka.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup/kafka/kafka.go b/setup/kafka/kafka.go index 5f2d40552..c8882e8bf 100644 --- a/setup/kafka/kafka.go +++ b/setup/kafka/kafka.go @@ -91,9 +91,9 @@ func setupNATS(cfg *config.Kafka) (sarama.Consumer, sarama.SyncProducer) { // Typing events can be removed from the stream, as they are only relevant for a short time if topic == config.TopicOutputTypingEvent { - maxLifeTime = time.Second * 30 + maxLifeTime = time.Second * 60 } - _, _ = s.AddStream(&nats.StreamConfig{ + _, err = s.AddStream(&nats.StreamConfig{ Name: sn, Subjects: []string{topic}, MaxBytes: int64(*cfg.MaxMessageBytes), @@ -101,6 +101,9 @@ func setupNATS(cfg *config.Kafka) (sarama.Consumer, sarama.SyncProducer) { MaxAge: maxLifeTime, Duplicates: maxLifeTime / 2, }) + if err != nil { + logrus.WithError(err).WithField("stream", sn).Fatal("unable to add nats stream") + } } }