removed rateLimit from http router requests

improved logging
This commit is contained in:
2021-10-20 00:11:42 +02:00
parent 6e951183de
commit df33974b49
12 changed files with 49 additions and 2752 deletions

View File

@@ -3,7 +3,6 @@ package csgo
import (
"context"
"csgowtfd/ent"
"csgowtfd/ent/match"
"csgowtfd/utils"
"encoding/json"
"fmt"
@@ -322,7 +321,7 @@ func (d *DemoMatchLoader) gcWorker(apiKey string, rl ratelimit.Limiter) {
select {
case demo := <-d.parseDemo:
if !d.GCReady {
log.Infof("[DL] Postponing match %d (%s): GC not read", demo.MatchId, demo.ShareCode)
log.Infof("[DL] Postponing match %d (%s): GC not ready", demo.MatchId, demo.ShareCode)
time.Sleep(5 * time.Second)
d.parseDemo <- demo
continue
@@ -335,14 +334,14 @@ func (d *DemoMatchLoader) gcWorker(apiKey string, rl ratelimit.Limiter) {
}
d.lock.RLock()
iMatch, err := d.db.Match.Query().Where(match.ID(matchId)).Only(context.Background())
iMatch, err := d.db.Match.Get(context.Background(), matchId)
d.lock.RUnlock()
if err != nil {
switch e := err.(type) {
case *ent.NotFoundError:
break
default:
log.Errorf("[DL] Failure trying to find match %d in db: %v", matchId, e)
log.Errorf("[DL] Failure trying to lookup match %d in db: %v", matchId, e)
}
} else {
if iMatch.DemoParsed == false && iMatch.Date.After(time.Now().UTC().AddDate(0, 0, -30)) {