refactored some functions, added demo download retry

This commit is contained in:
2021-10-09 19:10:38 +02:00
parent 15b273f052
commit e938b05f52
13 changed files with 242 additions and 322 deletions

View File

@@ -21,9 +21,6 @@ type Demo struct {
ShareCode string
MatchId uint64
Url string
Rank int
Tickrate int
File string
}
type DemoParser struct {
@@ -128,14 +125,7 @@ func (p *DemoParser) parseWorker() {
if err != nil {
switch e := err.(type) {
case DemoNotFoundError:
p.lock.Lock()
err := tMatch.Update().SetDemoExpired(true).Exec(context.Background())
p.lock.Unlock()
if err != nil {
log.Errorf("[DP] Unable to set demo expire for match %d: %v", demo.MatchId, e)
continue
}
log.Warningf("[DP] Demo already expired for %d", demo.MatchId)
log.Warningf("[DP] Demo not found for %d. Maybe temp.?", demo.MatchId)
continue
default:
log.Warningf("[DP] Unable to download demo for %d: %v", demo.MatchId, e)