switched to rate.Limiter
This commit is contained in:
6
main.go
6
main.go
@@ -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{
|
||||
|
Reference in New Issue
Block a user