mirror of
https://github.com/ultrasn0w/huso.git
synced 2026-10-26 13:34:17 +01:00
Work around jikan bug
This commit is contained in:
1 parent
0c2fb5c546
commit
22179e38c8
1 file changed
+5
@@ -197,6 +197,11 @@ func GetDataJikan(apiAddr string) ([]byte, error) {
|
||||
ctx := context.Background()
|
||||
jikanLimiter.Wait(ctx)
|
||||
statusCode, body, err := fasthttp.Get(body, *jikanApiBaseUri+apiAddr)
|
||||
// retry bcs jikan kekw
|
||||
if statusCode == fasthttp.StatusInternalServerError {
|
||||
jikanLimiter.Wait(ctx)
|
||||
statusCode, body, err = fasthttp.Get(body, *jikanApiBaseUri+apiAddr)
|
||||
}
|
||||
if statusCode != fasthttp.StatusOK {
|
||||
return body, fmt.Errorf("unexpected response code: %s %d", *jikanApiBaseUri+apiAddr, statusCode)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user