mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-04-05 14:07:39 +03:00
More manager tests
This commit is contained in:
parent
57814cf855
commit
bd2ec7b2af
5 changed files with 188 additions and 109 deletions
|
@ -53,13 +53,7 @@ import (
|
|||
rate limiting:
|
||||
- login/account endpoints
|
||||
Tests:
|
||||
- APIs
|
||||
- CRUD tokens
|
||||
- Expire tokens
|
||||
- userManager can be nil
|
||||
- visitor with/without user
|
||||
- userManager.<NEWSTUFF>
|
||||
|
||||
Later:
|
||||
- Password reset
|
||||
- Pricing
|
||||
|
@ -569,7 +563,7 @@ func (s *Server) handlePublishWithoutResponse(r *http.Request, v *visitor) (*mes
|
|||
}
|
||||
}
|
||||
v.IncrMessages()
|
||||
if v.user != nil {
|
||||
if s.userManager != nil && v.user != nil {
|
||||
s.userManager.EnqueueStats(v.user)
|
||||
}
|
||||
s.mu.Lock()
|
||||
|
@ -1342,7 +1336,7 @@ func (s *Server) sendDelayedMessages() error {
|
|||
}
|
||||
for _, m := range messages {
|
||||
var v *visitor
|
||||
if m.User != "" {
|
||||
if s.userManager != nil && m.User != "" {
|
||||
user, err := s.userManager.User(m.User)
|
||||
if err != nil {
|
||||
log.Warn("%s Error sending delayed message: %s", logMessagePrefix(v, m), err.Error())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue