More todos

This commit is contained in:
binwiederhier 2023-02-23 09:38:53 -05:00
parent 483410c4a2
commit 0c3d832c5f
3 changed files with 4 additions and 3 deletions

View file

@ -1169,7 +1169,7 @@ func parseSubscribeParams(r *http.Request) (poll bool, since sinceMarker, schedu
// Note: This TEMPORARILY also registers all topics starting with "up" (= UnifiedPush). This is to ease the transition // Note: This TEMPORARILY also registers all topics starting with "up" (= UnifiedPush). This is to ease the transition
// until the Android app will send the "Rate-Topics" header. // until the Android app will send the "Rate-Topics" header.
func registerRateVisitors(topics []*topic, rateTopics []string, v *visitor) { func registerRateVisitors(topics []*topic, rateTopics []string, v *visitor) {
if len(rateTopics) > 0 && rateTopics[0] == rateTopicsWildcard { if len(rateTopics) == 1 && rateTopics[0] == rateTopicsWildcard {
for _, t := range topics { for _, t := range topics {
t.SetRateVisitor(v) t.SetRateVisitor(v)
} }

View file

@ -1996,6 +1996,8 @@ func TestServer_Matrix_SubscriberRateLimiting_UP_Only(t *testing.T) {
} }
} }
// FIXME add test for rate visitor expiration
func newTestConfig(t *testing.T) *Config { func newTestConfig(t *testing.T) *Config {
conf := NewConfig() conf := NewConfig()
conf.BaseURL = "http://127.0.0.1:12345" conf.BaseURL = "http://127.0.0.1:12345"

View file

@ -1,11 +1,10 @@
package server package server
import ( import (
"heckel.io/ntfy/log"
"math/rand" "math/rand"
"sync" "sync"
"time" "time"
"heckel.io/ntfy/log"
) )
const ( const (