Silence01: request retry on HTTP 500
This commit is contained in:
parent
3597047272
commit
c15e8b9782
1 changed files with 7 additions and 0 deletions
|
|
@ -2,7 +2,9 @@ package silence
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/evcc-io/evcc/util"
|
||||
"github.com/evcc-io/evcc/util/request"
|
||||
"github.com/samber/lo"
|
||||
|
|
@ -45,6 +47,11 @@ func (v *API) Vehicles() ([]string, error) {
|
|||
}), nil
|
||||
}
|
||||
|
||||
// force retry on HTTP 500
|
||||
if err2, ok := err.(request.StatusError); ok && err2.HasStatus(http.StatusInternalServerError) {
|
||||
err = api.ErrMustRetry
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue