feat: add 529 overload cooldown toggle and duration settings in admin gateway page
Move 529 overload cooldown configuration from config file to admin settings UI. Adds an enable/disable toggle and configurable cooldown duration (1-120 min) under /admin/settings gateway tab, stored as JSON in the settings table. When disabled, 529 errors are logged but accounts are no longer paused from scheduling. Falls back to config file value when DB is unreachable or settingService is nil.
This commit is contained in:
@@ -242,6 +242,33 @@ export async function deleteAdminApiKey(): Promise<{ message: string }> {
|
||||
return data
|
||||
}
|
||||
|
||||
// ==================== Overload Cooldown Settings ====================
|
||||
|
||||
/**
|
||||
* Overload cooldown settings interface (529 handling)
|
||||
*/
|
||||
export interface OverloadCooldownSettings {
|
||||
enabled: boolean
|
||||
cooldown_minutes: number
|
||||
}
|
||||
|
||||
export async function getOverloadCooldownSettings(): Promise<OverloadCooldownSettings> {
|
||||
const { data } = await apiClient.get<OverloadCooldownSettings>('/admin/settings/overload-cooldown')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateOverloadCooldownSettings(
|
||||
settings: OverloadCooldownSettings
|
||||
): Promise<OverloadCooldownSettings> {
|
||||
const { data } = await apiClient.put<OverloadCooldownSettings>(
|
||||
'/admin/settings/overload-cooldown',
|
||||
settings
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
// ==================== Stream Timeout Settings ====================
|
||||
|
||||
/**
|
||||
* Stream timeout settings interface
|
||||
*/
|
||||
@@ -499,6 +526,8 @@ export const settingsAPI = {
|
||||
getAdminApiKey,
|
||||
regenerateAdminApiKey,
|
||||
deleteAdminApiKey,
|
||||
getOverloadCooldownSettings,
|
||||
updateOverloadCooldownSettings,
|
||||
getStreamTimeoutSettings,
|
||||
updateStreamTimeoutSettings,
|
||||
getRectifierSettings,
|
||||
|
||||
Reference in New Issue
Block a user