Skip to content

Feat/per service concurrency limit #1381#1386

Open
Chapoly1305 wants to merge 2 commits intowindingwind:mainfrom
Chapoly1305:feat/per-service-concurrency-limit
Open

Feat/per service concurrency limit #1381#1386
Chapoly1305 wants to merge 2 commits intowindingwind:mainfrom
Chapoly1305:feat/per-service-concurrency-limit

Conversation

@Chapoly1305
Copy link
Copy Markdown
Contributor

image

This pull request introduces per-service concurrency limits for GPT-based translation services, allowing users to control the maximum number of simultaneous requests for each service. The implementation includes a concurrency manager, updates to service definitions and settings dialogs, and localization for the new setting in English, Chinese, and Italian.

Concurrency control core implementation:

  • Added a ServiceConcurrencyManager class and a Semaphore utility to manage and enforce per-service concurrency limits, ensuring that no more than the specified number of requests are processed simultaneously for each service. [1] [2]
  • Integrated the concurrency manager into the main addon state and the translation task runner, so all translation tasks for GPT services are now subject to concurrency control. [1] [2] [3] [4]

Service and settings updates:

  • Extended the TranslateService interface to support an optional concurrencyLimit property, and updated the GPT service factory to read and apply this limit from user preferences. [1] [2]
  • Added a numeric "Concurrency Limit" setting to the GPT and AzureGPT service dialogs, including support for custom GPT services, with a placeholder indicating that 0 means unlimited. [1] [2]
  • Registered new concurrency limit preferences for each GPT service in prefs.js. [1] [2]

Localization and documentation:

  • Updated English, Chinese, and Italian locale files to include labels and placeholders for the new concurrency limit setting. [1] [2] [3]
  • Documented the new concurrency limit feature in the README.md, explaining its purpose and usage.

@windingwind
Copy link
Copy Markdown
Owner

we probably want to reuse the logic of resource://zotero/concurrentCaller.mjs from Zotero itself?

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.

2 participants