Skip to content

Fix/cnki retry for #1383#1384

Open
Chapoly1305 wants to merge 2 commits intowindingwind:mainfrom
Chapoly1305:fix/cnki-retry
Open

Fix/cnki retry for #1383#1384
Chapoly1305 wants to merge 2 commits intowindingwind:mainfrom
Chapoly1305:fix/cnki-retry

Conversation

@Chapoly1305
Copy link
Copy Markdown
Contributor

This pull request improves the resilience of the CNKI translation service by introducing a generic retry mechanism for HTTP requests. The main changes are the addition of a reusable requestWithRetry helper and its integration into the token fetching and translation request flows.

Reliability improvements:

  • Added a new requestWithRetry helper function to handle automatic retries for asynchronous operations, improving robustness against transient network errors.
  • Updated the translation request in processTranslation to use requestWithRetry, retrying failed requests up to two times with exponential backoff.
  • Modified the getToken function to use requestWithRetry for token fetching, adding retries to the token acquisition process.

@Chapoly1305
Copy link
Copy Markdown
Contributor Author

Chapoly1305 commented Jan 31, 2026

Note, I need someone in china mainland help to test this change. My native IP route me to oversea domain which led to 404. I tried to set with dns resolve to mainland service, but their server seems down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant