TIM-JYU / TIM

TIM (The Interactive Material) is an open-source cloud-based platform for creating interactive learning documents.
https://tim.education/view/about/en-US
MIT License
13 stars 4 forks source link

Add optional arguments for translation sessions #3629

Closed saviit closed 3 months ago

saviit commented 3 months ago

Alleviates translation errors resulting from too many requests being sent to the translation service url.

Adds optional arguments max_workers and max_retries that are passed to the FuturesSession objects performing the translation requests. Both can be controlled in defaultconfig.py via the variable TRANSLATION_SESSION_OPTIONS.

max_workers defaults to 8 (FuturesSession default, moved to requests_futures.DEFAULT_MAX_WORKERS) if not set. max_retries defaults to requests.adapter.DEFAULT_RETRIES, which should be 0.

Current proposed default is 4 for both, which is set in defaultconfig.py by this PR.