reworked preventing parsing one match multiple times

This commit is contained in:
2022-02-04 05:43:29 +01:00
parent 6a4e2f3ee3
commit 466a000c86
3 changed files with 161 additions and 144 deletions

View File

@@ -174,18 +174,16 @@ func housekeeping() {
}
for _, m := range tMatches {
demoLoader.ParseMapL.Lock()
if _, ok := demoLoader.ParseMap[m.ShareCode]; ok {
demo := &csgo.Demo{MatchId: m.ID, ShareCode: m.ShareCode}
if demoLoader.IsLoading(demo) {
log.Infof("[HK] Skipping %s: parsing in progress", m.ShareCode)
demoLoader.ParseMapL.Unlock()
continue
}
log.Infof("[HK] Try reparsing match %d, played on %s", m.ID, m.Date)
err := demoLoader.LoadDemo(&csgo.Demo{MatchId: m.ID, ShareCode: m.ShareCode})
err := demoLoader.LoadDemo(demo)
if err != nil {
log.Warningf("[HK] Failure trying to parse match %d: %v", m.ID, err)
}
demoLoader.ParseMapL.Unlock()
}
// check for inconsistent matches