From 36685e9df9b9792d85ca7b448ff29a570f6389df Mon Sep 17 00:00:00 2001 From: Karmanyaah Malhotra Date: Mon, 20 Feb 2023 17:55:21 -0600 Subject: [PATCH] Suggested changes - https://github.com/binwiederhier/ntfy/pull/609/files/b9badee6dbb4d43d6f1abee2f433e7113bb86ab8#r1111115151 - https://github.com/binwiederhier/ntfy/pull/609/files/b9badee6dbb4d43d6f1abee2f433e7113bb86ab8#r1111114771 --- server/server.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/server.go b/server/server.go index 4a4be262..aa261d5e 100644 --- a/server/server.go +++ b/server/server.go @@ -675,8 +675,6 @@ func (s *Server) handlePublishWithoutResponse(r *http.Request, v *visitor) (*mes if err := s.messageCache.AddMessage(m); err != nil { return nil, err } - } else { - m.Expires = m.Time } u := v.User() if s.userManager != nil && u != nil && u.Tier != nil { @@ -1416,12 +1414,15 @@ func (s *Server) execManager() { defer s.mu.Unlock() for _, t := range s.topics { subs := t.SubscribersCount() - expiryMessage := "" - if subs == 0 { - expiryTime := time.Until(t.lastVisitorExpires) - expiryMessage = ", expires in " + expiryTime.String() + ev := log.Tag(tagManager) + if ev.IsTrace() { + expiryMessage := "" + if subs == 0 { + expiryTime := time.Until(t.lastVisitorExpires) + expiryMessage = ", expires in " + expiryTime.String() + } + ev.Trace("- topic %s: %d subscribers%s", t.ID, subs, expiryMessage) } - log.Tag(tagManager).Trace("- topic %s: %d subscribers%s", t.ID, subs, expiryMessage) msgs, exists := messageCounts[t.ID] if t.Stale() && (!exists || msgs == 0) { log.Tag(tagManager).Trace("Deleting empty topic %s", t.ID)