fix: address deep code review issues for RPM limiting
- Move IncrementRPM after Forward success to prevent phantom RPM consumption during account switch retries - Add base_rpm input sanitization (clamp to 0-10000) in Create/Update - Add WindowCost scheduling checks to legacy path sticky sessions (4 check sites + 4 prefetch sites), fixing pre-existing gap - Clean up rpm_strategy/rpm_sticky_buffer when disabling RPM in BulkEditModal (JSONB merge cannot delete keys, use empty values) - Add json.Number test cases to TestGetBaseRPM/TestGetRPMStickyBuffer - Document TOCTOU race as accepted soft-limit design trade-off
This commit is contained in:
@@ -1224,8 +1224,12 @@ const buildUpdatePayload = (): Record<string, unknown> | null => {
|
||||
extra.rpm_sticky_buffer = bulkRpmStickyBuffer.value
|
||||
}
|
||||
} else {
|
||||
// 关闭 RPM 限制 - 设置 base_rpm 为 0
|
||||
// 关闭 RPM 限制 - 设置 base_rpm 为 0,并用空值覆盖关联字段
|
||||
// 后端使用 JSONB || merge 语义,不会删除已有 key,
|
||||
// 所以必须显式发送空值来重置(后端读取时会 fallback 到默认值)
|
||||
extra.base_rpm = 0
|
||||
extra.rpm_strategy = ''
|
||||
extra.rpm_sticky_buffer = 0
|
||||
}
|
||||
updates.extra = extra
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user