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