switched to rate.Limiter

This commit is contained in:
2022-03-30 15:32:25 +02:00
parent ac512aec2f
commit acbfb97014
5 changed files with 40 additions and 23 deletions

View File

@@ -24,8 +24,8 @@ import (
"github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/common"
log "github.com/sirupsen/logrus"
"github.com/wercker/journalhook"
"go.uber.org/ratelimit"
"golang.org/x/text/language"
"golang.org/x/time/rate"
"gopkg.in/yaml.v3"
"net"
"net/http"
@@ -45,7 +45,7 @@ var (
db *ent.Client
rdb *redis.Client
rdc *cache.Cache
rL ratelimit.Limiter
rL *rate.Limiter
configFlag = flag.String("config", "config.yaml", "Set config file to use")
journalLogFlag = flag.Bool("journal", false, "Log to systemd journal instead of stdout")
sqlDebugFlag = flag.Bool("sqldebug", false, "Debug SQL queries")
@@ -1150,7 +1150,7 @@ func main() {
LocalCache: cache.NewTinyLFU(1000, time.Minute),
})
rL = ratelimit.New(conf.Steam.RatePerSecond)
rL = rate.NewLimiter(rate.Limit(conf.Steam.RatePerSecond), 100)
// setup GC
err = demoLoader.Setup(&csgo.DemoMatchLoaderConfig{