Karmanyaah Malhotra 2023-02-20 17:55:21 -06:00
parent b9badee6db
commit 36685e9df9
1 changed files with 8 additions and 7 deletions

View File

@ -675,8 +675,6 @@ func (s *Server) handlePublishWithoutResponse(r *http.Request, v *visitor) (*mes
if err := s.messageCache.AddMessage(m); err != nil { if err := s.messageCache.AddMessage(m); err != nil {
return nil, err return nil, err
} }
} else {
m.Expires = m.Time
} }
u := v.User() u := v.User()
if s.userManager != nil && u != nil && u.Tier != nil { if s.userManager != nil && u != nil && u.Tier != nil {
@ -1416,12 +1414,15 @@ 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()
ev := log.Tag(tagManager)
if ev.IsTrace() {
expiryMessage := "" expiryMessage := ""
if subs == 0 { if subs == 0 {
expiryTime := time.Until(t.lastVisitorExpires) expiryTime := time.Until(t.lastVisitorExpires)
expiryMessage = ", expires in " + expiryTime.String() expiryMessage = ", expires in " + expiryTime.String()
} }
log.Tag(tagManager).Trace("- topic %s: %d subscribers%s", t.ID, subs, expiryMessage) ev.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)