updated deps; code cleanup; updated golangci linter conf

This commit is contained in:
2023-08-07 22:38:24 +02:00
parent 3fd0a4204b
commit dacc86dd83
7 changed files with 220 additions and 193 deletions

View File

@@ -161,9 +161,8 @@ func (dml *DemoMatchLoader) getMatchDetails(sharecode string) (*protobuf.CMsgGCC
for matchDetails := range dml.matchRecv {
if *matchDetails.Matches[0].Matchid == matchID {
return matchDetails, nil
} else {
dml.matchRecv <- matchDetails
}
dml.matchRecv <- matchDetails
}
return nil, err
}
@@ -173,8 +172,7 @@ func (dml *DemoMatchLoader) connectToSteam() error {
return nil
}
_, err := dml.client.Connect()
if err != nil {
if _, err := dml.client.Connect(); err != nil {
return err
}
return nil
@@ -188,7 +186,7 @@ func (dml *DemoMatchLoader) Setup(config *DemoMatchLoaderConfig) error {
dml.parseMap = map[string]bool{}
dml.parseMapL = new(sync.RWMutex)
dml.cache = config.Cache
dml.connectFeedback = make(chan int, 10) //nolint:gomnd
dml.connectFeedback = make(chan int, 10)
dml.connectionWait = retry.WithCappedDuration(time.Minute*time.Duration(config.RetryTimeout), retry.NewExponential(time.Minute))
dml.connectionWaitTmpl = retry.WithCappedDuration(time.Minute*time.Duration(config.RetryTimeout), retry.NewExponential(time.Minute))
err := dml.dp.Setup(config.DB, config.Worker, config.SprayTimeout)
@@ -223,8 +221,8 @@ func (dml *DemoMatchLoader) Setup(config *DemoMatchLoaderConfig) error {
if err != nil {
return err
}
dml.matchRecv = make(chan *protobuf.CMsgGCCStrike15V2_MatchList, 1000) //nolint:gomnd
dml.parseDemo = make(chan *Demo, 1000) //nolint:gomnd
dml.matchRecv = make(chan *protobuf.CMsgGCCStrike15V2_MatchList, 1000)
dml.parseDemo = make(chan *Demo, 1000)
go dml.connectLoop()
go dml.steamEventHandler()
@@ -299,7 +297,7 @@ func (dml *DemoMatchLoader) steamEventHandler() {
go dml.setPlaying()
case *steam.LogOnFailedEvent:
log.Debugf("[DL] Steam login denied: %+v", e)
switch e.Result {
switch e.Result { //nolint:exhaustive
case steamlang.EResult_AccountLogonDenied:
log.Fatalf("[DL] Please provide AuthCode in config")
case steamlang.EResult_InvalidPassword:
@@ -426,7 +424,7 @@ func (dml *DemoMatchLoader) handleDemo(demo *Demo, apiKey string, rl *rate.Limit
matchZero := matchDetails.GetMatches()[0]
lastRound := matchZero.GetRoundstatsall()[len(matchZero.Roundstatsall)-1]
var players []*ent.Player
var players []*ent.Player //nolint:prealloc
for _, accountID := range lastRound.GetReservation().GetAccountIds() {
tPlayer, err := utils.Player(tx.Client(), AccountID2SteamID(accountID), apiKey, rl)