From 55e077750785093cad96f380bcf12667a3f206ec Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 6 Aug 2021 21:42:51 +0200 Subject: [PATCH] Fix: Do not break posting on one non-fresh stream Signed-off-by: Knut Ahlers --- mod_livePosting.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mod_livePosting.go b/mod_livePosting.go index c4c788e..2749e64 100644 --- a/mod_livePosting.go +++ b/mod_livePosting.go @@ -120,9 +120,17 @@ func (m modLivePosting) fetchAndPostForUsername(usernames ...string) error { continue } - if time.Since(stream.StartedAt) > streamFreshness { + isFresh := time.Since(stream.StartedAt) <= streamFreshness + + log.WithFields(log.Fields{ + "isFresh": isFresh, + "started_at": stream.StartedAt, + "user": user.DisplayName, + }).Trace("Found user / stream combination") + + if !isFresh { // Stream is too old, don't annoounce - return nil + continue } if err = m.sendLivePost(