Skip to content

Commit

Permalink
Chore short logger info
Browse files Browse the repository at this point in the history
  • Loading branch information
ihavecoke committed Jun 15, 2024
1 parent 9ed62a9 commit a86abe8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 42 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/build.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Deploy Release
on:
push:
branches:
- main
- release

concurrency:
Expand Down
20 changes: 11 additions & 9 deletions scripts/wiki/fetch-wikis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ function delay(ms) {
}

let retryTimes = 0;

export async function fetchWikiList(memo: IWiki[], updated_at = null, limit = 100) {
console.log('--> fetch wikis from:', dayjs(updated_at * 1000).format('YYYY-MM-DD HH:mm:ss'));
const currentURL = `${apiBaseURL}/api/forward/social/wiki/lists?updated_at=${updated_at}&limit=${limit}`;
console.log("--> fetch wikis from:", dayjs(updated_at * 1000).format("YYYY-MM-DD HH:mm:ss"));
const currentPath = `api/forward/social/wiki/lists?updated_at=${updated_at}&limit=${limit}`;
const currentURL = `${apiBaseURL}/currentPath`;
try {
console.log('--> fetch url: ', currentURL)
console.log("--> fetch url: ", currentPath);
const resp = await axios.get(currentURL);
if(!resp.data){
if(retryTimes < 3){
if (!resp.data) {
if (retryTimes < 3) {
retryTimes += 1;
console.log(`[warning] found wikis length = 0 now delay 1000ms retry request ${currentURL} times ${retryTimes}`,)
await delay(1000)
console.log(`[warning] found wikis length = 0 now delay 1000ms retry request ${currentPath} times ${retryTimes}`);
await delay(1000);
await fetchWikiList(memo, updated_at, limit);
}
}else{
} else {
retryTimes = 0;
}
const {
Expand All @@ -36,7 +38,7 @@ export async function fetchWikiList(memo: IWiki[], updated_at = null, limit = 10
await fetchWikiList(memo, lastWiki.content_updated_at, limit);
}
} catch (error) {
console.error(`Failed to fetch ${currentURL} error:`, error);
console.error(`Failed to fetch ${currentPath} error:`, error);
}
return memo;
}

0 comments on commit a86abe8

Please sign in to comment.