mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 08:06:19 +00:00
feat(settings): update default concurrency policy
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -514,12 +514,13 @@ async fn concurrency_queue_settings_round_trip_into_the_runtime_snapshot() {
|
||||
let before = repository.load_runtime_settings().await.unwrap();
|
||||
assert_eq!(
|
||||
(
|
||||
before.values.max_concurrent_per_account,
|
||||
before.values.max_waiting_per_key,
|
||||
before.values.max_waiting_per_account,
|
||||
before.values.concurrency_wait_timeout_seconds,
|
||||
before.values.openai_guardian_reserved_concurrency,
|
||||
),
|
||||
(0, 0, 30, 0)
|
||||
(3, 10, 10, 30, 5)
|
||||
);
|
||||
let mut update = settings_with_margin(1234);
|
||||
update.values.max_concurrent_per_account = 7;
|
||||
|
||||
@@ -32,4 +32,4 @@ b49832e205405de7ef078f3b65c0c19f2c030b8984d42411598738b6b6c146bf 0031_proxy_and
|
||||
a0e409402611dbc76bb71393b8eda7c717756c18974dbabca305fdcb4b115f31 0032_usage_and_scheduling.sql
|
||||
592b80972af3bd8b3527b42da3703ca1106ecaf8fd5273c676189ca28fcbd067 0033_proxy_and_reset_credits.sql
|
||||
9c15a6b6c1f9eab8ad478772f98f8fc4a997b825d58d12cffe1a15579c5785b3 0034_account_error_protection.sql
|
||||
573e35299924e62d8e5e1867d69b00756bd6f53f03516d8d3791a4688e9b793d 0035_cpr_link.sql
|
||||
bd73379456839e8a12d7591ad2a839901af0f5ba27871248569abdfa26bc83ef 0035_cpr_link_and_concurrency_defaults.sql
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
-- 互联公开权限随 Key 保存
|
||||
alter table client_api_keys
|
||||
add column peer_sharing_json jsonb not null
|
||||
default '{"enabled":false,"sharePool":false,"shareQuota":false,"sharePlans":false}';
|
||||
|
||||
-- 各额度来源共用当前快照,协议入口另行限制响应大小
|
||||
alter table provider_accounts drop constraint provider_accounts_quota_ck;
|
||||
alter table provider_accounts add constraint provider_accounts_quota_ck check (
|
||||
provider_quota_json is null or (
|
||||
jsonb_typeof(provider_quota_json) = 'object'
|
||||
and octet_length(provider_quota_json::text) <= 8388608
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,32 @@
|
||||
-- 互联公开权限随 Key 保存
|
||||
alter table client_api_keys
|
||||
add column peer_sharing_json jsonb not null
|
||||
default '{"enabled":false,"sharePool":false,"shareQuota":false,"sharePlans":false}';
|
||||
|
||||
-- 各额度来源共用当前快照,协议入口另行限制响应大小
|
||||
alter table provider_accounts drop constraint provider_accounts_quota_ck;
|
||||
alter table provider_accounts add constraint provider_accounts_quota_ck check (
|
||||
provider_quota_json is null or (
|
||||
jsonb_typeof(provider_quota_json) = 'object'
|
||||
and octet_length(provider_quota_json::text) <= 8388608
|
||||
)
|
||||
);
|
||||
|
||||
-- 初始并发策略,已保存的运行设置保持原值
|
||||
alter table runtime_settings
|
||||
alter column max_concurrent_per_account set default 3,
|
||||
alter column max_waiting_per_key set default 10,
|
||||
alter column max_waiting_per_account set default 10,
|
||||
alter column openai_guardian_reserved_concurrency set default 5;
|
||||
|
||||
update runtime_settings
|
||||
set max_concurrent_per_account = 3,
|
||||
max_waiting_per_key = 10,
|
||||
max_waiting_per_account = 10,
|
||||
openai_guardian_reserved_concurrency = 5
|
||||
where config_revision = 1
|
||||
and max_concurrent_per_account = 5
|
||||
and max_waiting_per_key = 0
|
||||
and max_waiting_per_account = 0
|
||||
and concurrency_wait_timeout_seconds = 30
|
||||
and openai_guardian_reserved_concurrency = 0;
|
||||
+3
-3
@@ -1915,11 +1915,11 @@ UA、平台参数及自动 Git 上下文版本由 [OpenAI 上游客户端身份]
|
||||
|
||||
### 并发与排队
|
||||
|
||||
`maxConcurrentPerAccount` 是默认账号并发上限,初始值为 5,取值 0~4294967295;`0` 表示不限制。
|
||||
`maxConcurrentPerAccount` 是默认账号并发上限,初始值为 3,取值 0~4294967295;`0` 表示不限制。
|
||||
账号的 `concurrencyLimit: null` 继承该默认值,单独设置的正数上限仍优先生效。
|
||||
无限并发仍统计在途请求,并遵守账号可用性与 Client Key 限制
|
||||
|
||||
`maxWaitingPerKey` 与 `maxWaitingPerAccount` 是全局统一的普通排队容量,取值 0~1,000,默认 0(关闭);
|
||||
`maxWaitingPerKey` 与 `maxWaitingPerAccount` 是全局统一的普通排队容量,取值 0~1,000,默认 10,`0` 表示关闭;
|
||||
每个 Key、每个账号各自独立计数,没有单对象覆盖字段。执行并发为 5、最大排队数为 5 时,
|
||||
该对象最多容纳 5 个执行请求与 5 个等待请求。Key 并发为 0(不限)时跳过 Key 排队。
|
||||
OpenAI 严格亲和下后代线程的会话账号等待不随普通账号排队关闭,见 [Client Key 等待规则](#7-client-key)。
|
||||
@@ -1927,7 +1927,7 @@ OpenAI 严格亲和下后代线程的会话账号等待不随普通账号排队
|
||||
切换账号或内部重试不重新计时;若插件设置了请求总时限,等待也计入该时限。排队超时不用于中断已开始的上游生成。
|
||||
设置更新请求须包含这三个字段,新请求使用更新后的快照
|
||||
|
||||
`openaiGuardianReservedConcurrency`(默认 0,取值 0~4,294,967,295)设置 Codex Guardian 自动审批的每账号独立并发,保存后对新请求生效。
|
||||
`openaiGuardianReservedConcurrency`(默认 5,取值 0~4,294,967,295)设置 Codex Guardian 自动审批的每账号独立并发,保存后对新请求生效。
|
||||
Guardian 以 `subagent_kind` 或 `client_metadata.x-openai-subagent` 值 `guardian` 识别。取值 R 大于 0 时,
|
||||
普通请求保留账号原上限 L,Guardian 单独计数并最多运行 R 个,两类请求互不占用名额,也不借用对方空位。
|
||||
例如 L 为 10、R 为 3 时,可以同时运行 10 个普通请求和 3 个审批请求;普通并发不限时,审批仍受 R 限制。
|
||||
|
||||
Reference in New Issue
Block a user