diff options
| author | Bobby <[email protected]> | 2026-02-06 18:26:15 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-02-06 18:26:15 +0530 |
| commit | 185d84e2dbe18dca60592bb33f491c5cd3d09403 (patch) | |
| tree | 49ef4e02b9e83bce48610c0a44a457927bdc78c5 /utils | |
| parent | 31b5543be4faa4f01946d532d4b5e34828b285b5 (diff) | |
| download | metachan-185d84e2dbe18dca60592bb33f491c5cd3d09403.tar.xz metachan-185d84e2dbe18dca60592bb33f491c5cd3d09403.zip | |
Refactor database interactions: replace direct database calls with DB variable and implement batch creation for images and producers
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/api/jikan/jikan.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/api/jikan/jikan.go b/utils/api/jikan/jikan.go index 87c7cfd..244253d 100644 --- a/utils/api/jikan/jikan.go +++ b/utils/api/jikan/jikan.go @@ -108,7 +108,15 @@ func (c *client) makeRequest(ctx context.Context, url string) ([]byte, error) { } return bytes, nil + case http.StatusNotFound: + logger.Warnf("JikanClient", "Resource not found: %s", url) + return nil, errors.New("resource not found") default: + if response.StatusCode >= 400 && response.StatusCode < 500 { + logger.Warnf("JikanClient", "Client error %d for %s", response.StatusCode, url) + return nil, fmt.Errorf("client error: status %d", response.StatusCode) + } + retries++ backoffDuration := c.getBackOffDuration(retries) |
