refactor: job vs queue naming (#23902)

This commit is contained in:
Jason Rasmussen
2025-11-14 14:42:00 -05:00
committed by GitHub
parent 1200bfad13
commit d784d431d0
36 changed files with 1356 additions and 1325 deletions

View File

@@ -5,13 +5,7 @@
import JobCreateModal from '$lib/modals/JobCreateModal.svelte';
import { asyncTimeout } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import {
getAllJobsStatus,
JobCommand,
sendJobCommand,
type AllJobStatusResponseDto,
type JobName,
} from '@immich/sdk';
import { getQueuesLegacy, QueueCommand, QueueName, runQueueCommandLegacy, type QueuesResponseDto } from '@immich/sdk';
import { Button, HStack, modalManager, Text } from '@immich/ui';
import { mdiCog, mdiPlay, mdiPlus } from '@mdi/js';
import { onDestroy, onMount } from 'svelte';
@@ -24,23 +18,23 @@
let { data }: Props = $props();
let jobs: AllJobStatusResponseDto | undefined = $state();
let jobs: QueuesResponseDto | undefined = $state();
let running = true;
const pausedJobs = $derived(
Object.entries(jobs ?? {})
.filter(([_, jobStatus]) => jobStatus.queueStatus?.isPaused)
.map(([jobName]) => jobName as JobName),
.filter(([_, queue]) => queue.queueStatus?.isPaused)
.map(([name]) => name as QueueName),
);
const handleResumePausedJobs = async () => {
try {
for (const jobName of pausedJobs) {
await sendJobCommand({ id: jobName, jobCommandDto: { command: JobCommand.Resume, force: false } });
for (const name of pausedJobs) {
await runQueueCommandLegacy({ name, queueCommandDto: { command: QueueCommand.Resume, force: false } });
}
// Refresh jobs status immediately after resuming
jobs = await getAllJobsStatus();
jobs = await getQueuesLegacy();
} catch (error) {
handleError(error, $t('admin.failed_job_command', { values: { command: 'resume', job: 'paused jobs' } }));
}
@@ -48,7 +42,7 @@
onMount(async () => {
while (running) {
jobs = await getAllJobsStatus();
jobs = await getQueuesLegacy();
await asyncTimeout(5000);
}
});

View File

@@ -1,12 +1,12 @@
import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAllJobsStatus } from '@immich/sdk';
import { getQueuesLegacy } from '@immich/sdk';
import type { PageLoad } from './$types';
export const load = (async ({ url }) => {
await authenticate(url, { admin: true });
const jobs = await getAllJobsStatus();
const jobs = await getQueuesLegacy();
const $t = await getFormatter();
return {

View File

@@ -17,10 +17,10 @@
getAllLibraries,
getLibraryStatistics,
getUserAdmin,
JobCommand,
JobName,
QueueCommand,
QueueName,
runQueueCommandLegacy,
scanLibrary,
sendJobCommand,
updateLibrary,
type LibraryResponseDto,
type LibraryStatsResponseDto,
@@ -151,7 +151,7 @@
const handleScanAll = async () => {
try {
await sendJobCommand({ id: JobName.Library, jobCommandDto: { command: JobCommand.Start } });
await runQueueCommandLegacy({ name: QueueName.Library, queueCommandDto: { command: QueueCommand.Start } });
toastManager.info($t('admin.refreshing_all_libraries'));
} catch (error) {