test: ntfy delivery client tests passing with mocks
This commit is contained in:
parent
b4931198af
commit
bb35813816
3 changed files with 17 additions and 3 deletions
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
576ec415093ffd592c81daf0dab3442671c1fdcd
|
||||
dc0f0cfb2b0498809134a337d182dd40e03564b3
|
||||
|
|
|
|||
|
|
@ -545,9 +545,23 @@ func (m *NotificationManager) checkDigestTime() {
|
|||
// sendDigest sends the morning digest with all queued notifications.
|
||||
func (m *NotificationManager) sendDigest() {
|
||||
m.mu.Lock()
|
||||
|
||||
// Check if already sent today
|
||||
todayDate := time.Now().In(m.location).Format("2006-01-02")
|
||||
if m.digestSentDate == todayDate {
|
||||
m.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Check if there are queued events
|
||||
if len(m.queuedForDigest) == 0 {
|
||||
m.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
queued := m.queuedForDigest
|
||||
m.queuedForDigest = make([]*Event, 0)
|
||||
m.digestSentDate = time.Now().In(m.location).Format("2006-01-02")
|
||||
m.digestSentDate = todayDate
|
||||
m.mu.Unlock()
|
||||
|
||||
if len(queued) == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue