1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-20 22:08:20 +02:00

Add since=all; make poll=1 default to since=all

This commit is contained in:
Philipp Heckel 2021-11-08 09:46:31 -05:00
parent 43c9a92748
commit d453db89a7
5 changed files with 43 additions and 14 deletions

View file

@ -29,7 +29,7 @@ func (s *memCache) AddMessage(m *message) error {
return nil
}
func (s *memCache) Messages(topic string, since time.Time) ([]*message, error) {
func (s *memCache) Messages(topic string, since sinceTime) ([]*message, error) {
s.mu.Lock()
defer s.mu.Unlock()
if _, ok := s.messages[topic]; !ok {
@ -38,7 +38,7 @@ func (s *memCache) Messages(topic string, since time.Time) ([]*message, error) {
messages := make([]*message, 0) // copy!
for _, m := range s.messages[topic] {
msgTime := time.Unix(m.Time, 0)
if msgTime == since || msgTime.After(since) {
if msgTime == since.Time() || msgTime.After(since.Time()) {
messages = append(messages, m)
}
}