3 Commits

Author SHA1 Message Date
b2c5d8f41c ...get rid of time 2025-07-22 20:30:02 +02:00
4d2c1622d3 Get rid of the timeout 2025-07-22 20:29:07 +02:00
82d1c5a8c8 Remove timeout parameter 2025-07-22 17:40:48 +02:00

View File

@@ -3,7 +3,6 @@ package cyutils
import ( import (
"net/http" "net/http"
"sync" "sync"
"time"
"golang.org/x/time/rate" "golang.org/x/time/rate"
) )
@@ -58,11 +57,10 @@ func (t *RateLimitedTransport) RoundTrip(req *http.Request) (*http.Response, err
} }
return t.base.RoundTrip(req) return t.base.RoundTrip(req)
} }
func LimitedHttp(rps float64, burst int, timeout time.Duration) *http.Client { func LimitedHttp(rps float64, burst int) *http.Client {
baseTransport := &http.Transport{ baseTransport := &http.Transport{
MaxIdleConns: 100, MaxIdleConns: 100,
MaxIdleConnsPerHost: 10, MaxIdleConnsPerHost: 10,
IdleConnTimeout: 10 * time.Second,
} }
// Initialize rate limiter // Initialize rate limiter
@@ -77,6 +75,5 @@ func LimitedHttp(rps float64, burst int, timeout time.Duration) *http.Client {
// Return configured client // Return configured client
return &http.Client{ return &http.Client{
Transport: transport, Transport: transport,
Timeout: timeout,
} }
} }