Skip to content

Commit

Permalink
Merge pull request #15 from LarveyOfficial/dev
Browse files Browse the repository at this point in the history
Should always re-try, and slower re-tries
  • Loading branch information
LarveyOfficial authored Apr 8, 2024
2 parents 6a4560a + 5bc39d6 commit 832e70e
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,13 @@ export default function Gif() {
keepPreviousData: true,
shouldRetryOnError: true,
onErrorRetry: (error, key, config, revalidate, { retryCount }) => {
// Never retry on 404.
if (error.status === 404) {
setIsRealError(true);
return;
}

if (retryCount < 5) {
if (retryCount < 10) {
setIsRealError(false);
}

// Only retry up to 5 times.
if (retryCount >= 5) {
} else {
setIsRealError(true);
return;
}

// Retry every second
setTimeout(() => revalidate({ retryCount }), 1000);
setTimeout(() => revalidate({ retryCount }), 5000);
},
});

Expand Down

0 comments on commit 832e70e

Please sign in to comment.