From 0c3d832c5ff2d37c587c7726ae94ad8e87661472 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Thu, 23 Feb 2023 09:38:53 -0500 Subject: [PATCH] More todos --- server/server.go | 2 +- server/server_test.go | 2 ++ server/topic.go | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index d1b0122d..6ce60c03 100644 --- a/server/server.go +++ b/server/server.go @@ -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 // until the Android app will send the "Rate-Topics" header. 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 { t.SetRateVisitor(v) } diff --git a/server/server_test.go b/server/server_test.go index eab70018..09e711e7 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -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 { conf := NewConfig() conf.BaseURL = "http://127.0.0.1:12345" diff --git a/server/topic.go b/server/topic.go index 9ba60e2d..9b4f7571 100644 --- a/server/topic.go +++ b/server/topic.go @@ -1,11 +1,10 @@ package server import ( + "heckel.io/ntfy/log" "math/rand" "sync" "time" - - "heckel.io/ntfy/log" ) const (