Merge pull request #250 from IanShaw027/fix/custom-error-codes-disable-scheduling
fix(gateway): 自定义错误码触发停止调度
This commit is contained in:
@@ -778,6 +778,16 @@ const addPresetMapping = (from: string, to: string) => {
|
||||
const toggleErrorCode = (code: number) => {
|
||||
const index = selectedErrorCodes.value.indexOf(code)
|
||||
if (index === -1) {
|
||||
// Adding code - check for 429/529 warning
|
||||
if (code === 429) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes429Warning'))) {
|
||||
return
|
||||
}
|
||||
} else if (code === 529) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes529Warning'))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
selectedErrorCodes.value.push(code)
|
||||
} else {
|
||||
selectedErrorCodes.value.splice(index, 1)
|
||||
@@ -794,6 +804,16 @@ const addCustomErrorCode = () => {
|
||||
appStore.showInfo(t('admin.accounts.errorCodeExists'))
|
||||
return
|
||||
}
|
||||
// Check for 429/529 warning
|
||||
if (code === 429) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes429Warning'))) {
|
||||
return
|
||||
}
|
||||
} else if (code === 529) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes529Warning'))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
selectedErrorCodes.value.push(code)
|
||||
customErrorCodeInput.value = null
|
||||
}
|
||||
|
||||
@@ -1976,6 +1976,16 @@ const addPresetMapping = (from: string, to: string) => {
|
||||
const toggleErrorCode = (code: number) => {
|
||||
const index = selectedErrorCodes.value.indexOf(code)
|
||||
if (index === -1) {
|
||||
// Adding code - check for 429/529 warning
|
||||
if (code === 429) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes429Warning'))) {
|
||||
return
|
||||
}
|
||||
} else if (code === 529) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes529Warning'))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
selectedErrorCodes.value.push(code)
|
||||
} else {
|
||||
selectedErrorCodes.value.splice(index, 1)
|
||||
@@ -1993,6 +2003,16 @@ const addCustomErrorCode = () => {
|
||||
appStore.showInfo(t('admin.accounts.errorCodeExists'))
|
||||
return
|
||||
}
|
||||
// Check for 429/529 warning
|
||||
if (code === 429) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes429Warning'))) {
|
||||
return
|
||||
}
|
||||
} else if (code === 529) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes529Warning'))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
selectedErrorCodes.value.push(code)
|
||||
customErrorCodeInput.value = null
|
||||
}
|
||||
|
||||
@@ -936,6 +936,16 @@ const addPresetMapping = (from: string, to: string) => {
|
||||
const toggleErrorCode = (code: number) => {
|
||||
const index = selectedErrorCodes.value.indexOf(code)
|
||||
if (index === -1) {
|
||||
// Adding code - check for 429/529 warning
|
||||
if (code === 429) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes429Warning'))) {
|
||||
return
|
||||
}
|
||||
} else if (code === 529) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes529Warning'))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
selectedErrorCodes.value.push(code)
|
||||
} else {
|
||||
selectedErrorCodes.value.splice(index, 1)
|
||||
@@ -953,6 +963,16 @@ const addCustomErrorCode = () => {
|
||||
appStore.showInfo(t('admin.accounts.errorCodeExists'))
|
||||
return
|
||||
}
|
||||
// Check for 429/529 warning
|
||||
if (code === 429) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes429Warning'))) {
|
||||
return
|
||||
}
|
||||
} else if (code === 529) {
|
||||
if (!confirm(t('admin.accounts.customErrorCodes529Warning'))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
selectedErrorCodes.value.push(code)
|
||||
customErrorCodeInput.value = null
|
||||
}
|
||||
|
||||
@@ -1203,6 +1203,10 @@ export default {
|
||||
customErrorCodesHint: 'Only stop scheduling for selected error codes',
|
||||
customErrorCodesWarning:
|
||||
'Only selected error codes will stop scheduling. Other errors will return 500.',
|
||||
customErrorCodes429Warning:
|
||||
'429 already has built-in rate limit handling. Adding it to custom error codes will disable the account instead of temporary rate limiting. Are you sure?',
|
||||
customErrorCodes529Warning:
|
||||
'529 already has built-in overload handling. Adding it to custom error codes will disable the account instead of temporary overload marking. Are you sure?',
|
||||
selectedErrorCodes: 'Selected',
|
||||
noneSelectedUsesDefault: 'None selected (uses default policy)',
|
||||
enterErrorCode: 'Enter error code (100-599)',
|
||||
|
||||
@@ -1339,6 +1339,10 @@ export default {
|
||||
customErrorCodes: '自定义错误码',
|
||||
customErrorCodesHint: '仅对选中的错误码停止调度',
|
||||
customErrorCodesWarning: '仅选中的错误码会停止调度,其他错误将返回 500。',
|
||||
customErrorCodes429Warning:
|
||||
'429 已有内置的限流处理机制。添加到自定义错误码后,将直接停止调度而非临时限流。确定要添加吗?',
|
||||
customErrorCodes529Warning:
|
||||
'529 已有内置的过载处理机制。添加到自定义错误码后,将直接停止调度而非临时标记过载。确定要添加吗?',
|
||||
selectedErrorCodes: '已选择',
|
||||
noneSelectedUsesDefault: '未选择(使用默认策略)',
|
||||
enterErrorCode: '输入错误码 (100-599)',
|
||||
|
||||
Reference in New Issue
Block a user