mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-07-04 10:06:19 +02:00
Attachments limits; working visitor limit
This commit is contained in:
parent
70aefc2e48
commit
c45a28e6af
9 changed files with 287 additions and 186 deletions
server
|
@ -125,6 +125,20 @@ func (c *memCache) Prune(olderThan time.Time) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *memCache) AttachmentsSize(owner string) (int64, error) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
var size int64
|
||||
for topic := range c.messages {
|
||||
for _, m := range c.messages[topic] {
|
||||
if m.Attachment != nil && m.Attachment.Owner == owner {
|
||||
size += m.Attachment.Size
|
||||
}
|
||||
}
|
||||
}
|
||||
return size, nil
|
||||
}
|
||||
|
||||
func (c *memCache) pruneTopic(topic string, olderThan time.Time) {
|
||||
messages := make([]*message, 0)
|
||||
for _, m := range c.messages[topic] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue