feat: worker diagnostics in settings panel
Adds /api/v1/library/maintenance/worker-status (Celery inspect + queue depths + recent failed photos) and a Workers section in the Settings dialog so users can debug stuck queues and task failures without tailing container logs. Auto-polls every 5s while open. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -230,6 +230,45 @@ export interface RegenerateResult {
|
||||
}
|
||||
}
|
||||
|
||||
export interface WorkerInfo {
|
||||
name: string
|
||||
status: 'online' | 'unreachable'
|
||||
active: number
|
||||
reserved: number
|
||||
scheduled: number
|
||||
concurrency: number | null
|
||||
processed: Record<string, number>
|
||||
queues: string[]
|
||||
active_tasks: Array<{
|
||||
id: string
|
||||
name: string
|
||||
args: unknown
|
||||
time_start: number | null
|
||||
}>
|
||||
}
|
||||
|
||||
export interface WorkerFailure {
|
||||
photo_id: string
|
||||
filename: string
|
||||
media_type: string
|
||||
error: string
|
||||
updated_at: string | null
|
||||
}
|
||||
|
||||
export interface WorkerStatus {
|
||||
broker_ok: boolean
|
||||
broker_error: string | null
|
||||
inspect_error: string | null
|
||||
workers: WorkerInfo[]
|
||||
worker_count: number
|
||||
queues: Record<string, number>
|
||||
failures: {
|
||||
total: number
|
||||
recent: WorkerFailure[]
|
||||
}
|
||||
scan_errors: string[]
|
||||
}
|
||||
|
||||
export const library = {
|
||||
scan: async () => {
|
||||
const response = await api.post('/library/scan')
|
||||
@@ -265,6 +304,14 @@ export const library = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
/** Celery worker fleet diagnostics + recent task failures. Surfaced
|
||||
* in the Settings panel so users can debug stuck queues without
|
||||
* tailing container logs. */
|
||||
workerStatus: async (): Promise<WorkerStatus> => {
|
||||
const response = await api.get('/library/maintenance/worker-status')
|
||||
return response.data
|
||||
},
|
||||
|
||||
/** Re-run the source-roots / folders / photos integrity cleanup that
|
||||
* normally runs on backend startup. */
|
||||
cleanup: async (): Promise<{ status: string; message?: string }> => {
|
||||
|
||||
Reference in New Issue
Block a user