This commit is contained in:
tangly1024
2022-04-29 14:58:28 +08:00
parent 245290d46d
commit b45500a6ad

View File

@@ -29,7 +29,7 @@ export async function getPostBlocks(id, from, slice) {
*/
async function getPageWithRetry(id, from, retryAttempts = 3) {
if (retryAttempts && retryAttempts > 0) {
console.error('[重试请求]', `from:${from}`, `id:${id}`, `剩余次数:${retryAttempts}`)
console.error('[发起请求]', `from:${from}`, `id:${id}`, `剩余重试次数:${retryAttempts}`)
try {
const authToken = BLOG.NOTION_ACCESS_TOKEN || null
const api = new NotionAPI({ authToken })
@@ -39,7 +39,7 @@ async function getPageWithRetry(id, from, retryAttempts = 3) {
const cacheKey = 'page_block_' + id
const pageBlock = await getDataFromCache(cacheKey)
if (pageBlock) {
console.error('[获取缓存]', `from:${from}`, `id:${id}`, `剩余次数:${retryAttempts}`)
console.error('[重试获取缓存]', `from:${from}`, `id:${id}`)
return pageBlock
}
return await getPageWithRetry(id, from, retryAttempts - 1)