Skip to content

Commit d9e8625

Browse files
committed
Revert "fix: retry notion getter (#885)"
This reverts commit 3cb34fc.
1 parent 4c04b1b commit d9e8625

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

src/components/Notion/utils.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,11 @@ import { NotionAPI } from 'notion-client'
33
import { getRevalidate } from 'utils/revalidate'
44

55
const notion = new NotionAPI()
6-
7-
const getNotionPageWithRetry = async (id: string, retries = 3) => {
8-
try {
9-
return await notion.getPage(id)
10-
} catch (e) {
11-
if (retries > 0) {
12-
const error = e as { response?: { status?: number; headers?: Headers } }
13-
const status = error.response?.status
14-
if (status === 429) {
15-
const retryAfterHeader = error.response?.headers?.get('retry-after')
16-
const delay = retryAfterHeader ? parseFloat(retryAfterHeader) * 1000 : 5000
17-
await new Promise((resolve) => setTimeout(resolve, delay))
18-
return getNotionPageWithRetry(id, retries - 1)
19-
}
20-
}
21-
throw e
22-
}
23-
}
24-
256
export const getNotionContentProps = unstable_cache(
267
async (id: string) => {
278
try {
28-
return await getNotionPageWithRetry(id)
9+
const result = await notion.getPage(id)
10+
return result
2911
} catch (e) {
3012
console.error('Unable to get content from Notion', e)
3113
return undefined

0 commit comments

Comments
 (0)