moved spray timeout to config

This commit is contained in:
2021-11-09 18:59:00 +01:00
parent 0fdea7b327
commit 1d6396abfd
5 changed files with 42 additions and 36 deletions

26
main.go
View File

@@ -34,6 +34,7 @@ import (
"time"
)
//goland:noinspection ALL
var (
conf = utils.Conf{}
demoLoader = &csgo.DemoMatchLoader{}
@@ -42,7 +43,7 @@ var (
rdb *redis.Client
rdc *cache.Cache
rL ratelimit.Limiter
configFlag = flag.String("config", "config.yaml", "Set config to use")
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")
)
@@ -695,7 +696,7 @@ func getMatch(w http.ResponseWriter, r *http.Request) {
Stats: []*utils.StatsResponse{},
}
if tMatch.Date.After(time.Now().AddDate(0, 0, -30)) {
if tMatch.Date.After(time.Now().AddDate(0, 0, -1*conf.Csgowtfd.DemosExpire)) {
mResponse.ReplayURL = tMatch.ReplayURL
}
@@ -850,16 +851,17 @@ func main() {
// setup GC
err = demoLoader.Setup(&csgo.DemoMatchLoaderConfig{
Username: conf.Steam.Username,
Password: conf.Steam.Password,
AuthCode: conf.Steam.AuthCode,
Sentry: conf.Steam.Sentry,
LoginKey: conf.Steam.LoginKey,
Db: db,
Worker: conf.Parser.Worker,
ApiKey: conf.Steam.APIKey,
RateLimit: rL,
Cache: rdc,
Username: conf.Steam.Username,
Password: conf.Steam.Password,
AuthCode: conf.Steam.AuthCode,
Sentry: conf.Steam.Sentry,
LoginKey: conf.Steam.LoginKey,
Db: db,
Worker: conf.Parser.Worker,
ApiKey: conf.Steam.APIKey,
RateLimit: rL,
Cache: rdc,
SprayTimeout: conf.Csgowtfd.SprayTimeout,
})
if err != nil {
log.Fatalf("Unbale to setup DemoLoader: %v", err)