chore: go fixes

This commit is contained in:
2026-05-02 18:58:13 +02:00
parent b7fee9d063
commit f0b5a4f9a8
8 changed files with 19 additions and 41 deletions

View File

@@ -316,10 +316,7 @@ func (c *Client) fetchWithRetry(ctx context.Context, urlStr string, out any) err
if retryable && attempt < maxRetries-1 {
resp.Body.Close()
delay := retryDelay(attempt)
if retryAfter > delay {
delay = retryAfter
}
delay := max(retryAfter, retryDelay(attempt))
if retryErr := waitForRetry(ctx, delay); retryErr != nil {
return retryErr

View File

@@ -100,16 +100,16 @@ func (a Anime) ShortDuration() string {
return ""
}
// Duration format: "23 min per ep" or "1 hr 30 min"
var num string
var num strings.Builder
for _, c := range a.Duration {
if c >= '0' && c <= '9' {
num += string(c)
} else if c == ' ' && num != "" {
num.WriteString(string(c))
} else if c == ' ' && num.String() != "" {
break
}
}
if num != "" {
return num + "m"
if num.String() != "" {
return num.String() + "m"
}
return a.Duration
}