diff --git a/distro/debian/snapshot/metasnap/metasnap.go b/distro/debian/snapshot/metasnap/metasnap.go index 62f1741..3fa40ac 100644 --- a/distro/debian/snapshot/metasnap/metasnap.go +++ b/distro/debian/snapshot/metasnap/metasnap.go @@ -20,6 +20,7 @@ const apiURL = "http://metasnap.debian.net/cgi-bin/api?" var ( limiterTimeout time.Duration = time.Second / 20 + limiterMaxTimeout time.Duration = time.Second * 3 limiterBurst int = 3 limiterUpdateDelay time.Duration = time.Second * 10 @@ -28,6 +29,9 @@ var ( func lowerLimit() { limiterTimeout = limiterTimeout * 2 + if limiterTimeout > limiterMaxTimeout { + limiterTimeout = limiterMaxTimeout + } log.Info().Msgf("limiter timeout set to %v", limiterTimeout) Limiter.SetLimitAt( time.Now().Add(limiterUpdateDelay), diff --git a/distro/debian/snapshot/mr/mr.go b/distro/debian/snapshot/mr/mr.go index 8ee826f..dc6fba6 100644 --- a/distro/debian/snapshot/mr/mr.go +++ b/distro/debian/snapshot/mr/mr.go @@ -17,6 +17,7 @@ const apiURL = "https://snapshot.debian.org/mr" var ( limiterTimeout time.Duration = time.Second / 20 + limiterMaxTimeout time.Duration = time.Second * 3 limiterBurst int = 3 limiterUpdateDelay time.Duration = time.Second * 10 @@ -25,6 +26,9 @@ var ( func lowerLimit() { limiterTimeout = limiterTimeout * 2 + if limiterTimeout > limiterMaxTimeout { + limiterTimeout = limiterMaxTimeout + } log.Info().Msgf("limiter timeout set to %v", limiterTimeout) Limiter.SetLimitAt( time.Now().Add(limiterUpdateDelay),