fixed demos not found error

This commit is contained in:
2022-11-28 19:26:26 +01:00
parent 56059d2cd0
commit eb8487d0c4

View File

@@ -54,9 +54,9 @@ type Spray struct {
Spray [][]float32
}
type DemoNotFoundError struct {
error
}
var (
DemoNotFoundError = errors.New("demo not found")
)
func (s *Sprays) Add(currentTime time.Duration, sprayPoint []float32, timeout int) {
sprayFound := false
@@ -134,7 +134,7 @@ func (d *Demo) download() (io.Reader, error) {
}
if r.StatusCode != http.StatusOK {
return nil, DemoNotFoundError{fmt.Errorf("demo not found")}
return nil, DemoNotFoundError
}
return bzip2.NewReader(r.Body), nil
}
@@ -211,7 +211,7 @@ workloop:
startTime := time.Now()
fDemo, err := demo.download()
if err != nil {
if errors.Is(err, DemoNotFoundError{}) {
if errors.Is(err, DemoNotFoundError) {
_ = utils.Rollback(tx, err)
if tMatch.Date.Before(time.Now().UTC().AddDate(0, 0, -30)) {
log.Infof("[DP] demo expired for match %d", tMatch.ID)