feat(channels): add auto-disable-only channel test mode (#6728)
This commit is contained in:
@@ -63,7 +63,11 @@ const numericString = z.string().refine((value) => {
|
||||
return !Number.isNaN(Number(trimmed)) && Number(trimmed) >= 0
|
||||
}, 'Enter a non-negative number or leave empty')
|
||||
|
||||
const channelTestModes = ['scheduled_all', 'passive_recovery'] as const
|
||||
const channelTestModes = [
|
||||
'scheduled_all',
|
||||
'auto_ban_only',
|
||||
'passive_recovery',
|
||||
] as const
|
||||
type ChannelTestMode = (typeof channelTestModes)[number]
|
||||
|
||||
const routingReliabilitySchema = z
|
||||
@@ -148,7 +152,10 @@ type NormalizedRoutingReliabilityValues = {
|
||||
}
|
||||
|
||||
function normalizeChannelTestMode(value?: string): ChannelTestMode {
|
||||
return value === 'passive_recovery' ? 'passive_recovery' : 'scheduled_all'
|
||||
if (value === 'auto_ban_only' || value === 'passive_recovery') {
|
||||
return value
|
||||
}
|
||||
return 'scheduled_all'
|
||||
}
|
||||
|
||||
const buildFormDefaults = (
|
||||
@@ -250,6 +257,23 @@ export function RoutingReliabilitySection({
|
||||
const autoDisableStatusCodes = form.watch('AutomaticDisableStatusCodes')
|
||||
const autoRetryStatusCodes = form.watch('AutomaticRetryStatusCodes')
|
||||
const channelTestMode = form.watch('monitor_setting.channel_test_mode')
|
||||
let channelTestModeDescription: string
|
||||
switch (channelTestMode) {
|
||||
case 'auto_ban_only':
|
||||
channelTestModeDescription = t(
|
||||
'Periodically checks only channels with auto-disable enabled, excluding manually disabled channels.'
|
||||
)
|
||||
break
|
||||
case 'passive_recovery':
|
||||
channelTestModeDescription = t(
|
||||
'Does not check healthy channels. It only rechecks auto-disabled channels and restores them after they recover.'
|
||||
)
|
||||
break
|
||||
default:
|
||||
channelTestModeDescription = t(
|
||||
'Periodically checks all channels except manually disabled ones to detect failures and recover channels automatically.'
|
||||
)
|
||||
}
|
||||
const autoDisableParsed = useMemo(
|
||||
() => parseHttpStatusCodeRules(autoDisableStatusCodes),
|
||||
[autoDisableStatusCodes]
|
||||
@@ -391,11 +415,17 @@ export function RoutingReliabilitySection({
|
||||
items={[
|
||||
{
|
||||
value: 'scheduled_all',
|
||||
label: t('Scheduled full test'),
|
||||
label: t('Actively check all channels'),
|
||||
},
|
||||
{
|
||||
value: 'auto_ban_only',
|
||||
label: t(
|
||||
'Actively check auto-disable-enabled channels'
|
||||
),
|
||||
},
|
||||
{
|
||||
value: 'passive_recovery',
|
||||
label: t('Passive recovery only'),
|
||||
label: t('Check channels awaiting recovery only'),
|
||||
},
|
||||
]}
|
||||
value={field.value}
|
||||
@@ -409,18 +439,19 @@ export function RoutingReliabilitySection({
|
||||
<SelectContent alignItemWithTrigger={false}>
|
||||
<SelectGroup>
|
||||
<SelectItem value='scheduled_all'>
|
||||
{t('Scheduled full test')}
|
||||
{t('Actively check all channels')}
|
||||
</SelectItem>
|
||||
<SelectItem value='auto_ban_only'>
|
||||
{t('Actively check auto-disable-enabled channels')}
|
||||
</SelectItem>
|
||||
<SelectItem value='passive_recovery'>
|
||||
{t('Passive recovery only')}
|
||||
{t('Check channels awaiting recovery only')}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormDescription>
|
||||
{t(
|
||||
'Scheduled full test probes non-manually-disabled channels; passive recovery only checks auto-disabled channels after real request failures.'
|
||||
)}
|
||||
{channelTestModeDescription}
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
@@ -235,7 +235,10 @@ export type ModelSettings = {
|
||||
AutomaticRetryStatusCodes: string
|
||||
'monitor_setting.auto_test_channel_enabled': boolean
|
||||
'monitor_setting.auto_test_channel_minutes': number
|
||||
'monitor_setting.channel_test_mode': 'scheduled_all' | 'passive_recovery'
|
||||
'monitor_setting.channel_test_mode':
|
||||
| 'scheduled_all'
|
||||
| 'auto_ban_only'
|
||||
| 'passive_recovery'
|
||||
'channel_affinity_setting.enabled': boolean
|
||||
'channel_affinity_setting.switch_on_success': boolean
|
||||
'channel_affinity_setting.keep_on_channel_disabled': boolean
|
||||
|
||||
Reference in New Issue
Block a user