优化 文章加锁逻辑

This commit is contained in:
tangly1024
2022-03-26 21:01:37 +08:00
parent 320133cb59
commit 02320ba865
11 changed files with 68 additions and 62 deletions

View File

@@ -12,9 +12,9 @@ export async function getPostBlocks (id, from, slice, retryCount = 3) {
const authToken = BLOG.NOTION_ACCESS_TOKEN || null
const api = new NotionAPI({ authToken })
try {
console.log('[请求API]:', `from:${from}`, `id:${id}`)
console.warn('[请求API]:', `from:${from}`, `id:${id}`)
pageBlock = await api.getPage(id)
console.log('[请求成功]', `from:${from}`, `id:${id}`)
console.warn('[请求成功]', `from:${from}`, `id:${id}`)
} catch (error) {
console.error('[请求失败]', `from:${from}`, `id:${id}`, `error:${error}`)
if (retryCount && retryCount > 0) { // 重试