1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-04 19:04:15 +01:00

only log expiry if applicable

This commit is contained in:
Karmanyaah Malhotra 2023-02-14 14:21:33 -06:00
parent 6bfe4a9779
commit 7c5b9c0e62

View file

@ -1420,8 +1420,12 @@ func (s *Server) execManager() {
defer s.mu.Unlock() defer s.mu.Unlock()
for _, t := range s.topics { for _, t := range s.topics {
subs := t.SubscribersCount() subs := t.SubscribersCount()
expiryTime := time.Until(t.lastVisitorExpires) expiryMessage := ""
log.Tag(tagManager).Trace("- topic %s: %d subscribers, expires in %s", t.ID, subs, expiryTime) if subs == 0 {
expiryTime := time.Until(t.lastVisitorExpires)
expiryMessage = ", expires in " + expiryTime.String()
}
log.Tag(tagManager).Trace("- topic %s: %d subscribers%s", t.ID, subs, expiryMessage)
msgs, exists := messageCounts[t.ID] msgs, exists := messageCounts[t.ID]
if t.Stale() && (!exists || msgs == 0) { if t.Stale() && (!exists || msgs == 0) {
log.Tag(tagManager).Trace("Deleting empty topic %s", t.ID) log.Tag(tagManager).Trace("Deleting empty topic %s", t.ID)