From 56fab109a1a989ae4e4924b4ed59d9bca473a27d Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 6 Aug 2021 21:12:29 +0200 Subject: [PATCH] Prevent duplicate attribute parsing Signed-off-by: Knut Ahlers --- mod_livePosting.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mod_livePosting.go b/mod_livePosting.go index ecea6cb..c4c788e 100644 --- a/mod_livePosting.go +++ b/mod_livePosting.go @@ -111,14 +111,15 @@ func (m modLivePosting) fetchAndPostForUsername(usernames ...string) error { "users": len(users.Data), }).Trace("Found active streams from users") + // @attr stream_freshness optional duration "5m" How long after stream start to post shoutout + streamFreshness := m.attrs.MustDuration("stream_freshness", ptrDuration(livePostingDefaultStreamFreshness)) + for _, stream := range streams.Data { for _, user := range users.Data { if user.ID != stream.UserID { continue } - // @attr stream_freshness optional duration "5m" How long after stream start to post shoutout - streamFreshness := m.attrs.MustDuration("stream_freshness", ptrDuration(livePostingDefaultStreamFreshness)) if time.Since(stream.StartedAt) > streamFreshness { // Stream is too old, don't annoounce return nil