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:
parent
43c9a92748
commit
d453db89a7
5 changed files with 43 additions and 14 deletions
server
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue