chore: reload tables if job queue empties

This commit is contained in:
izzy
2025-12-18 17:16:55 +00:00
parent 4ed3386f07
commit 06f81f4b14
2 changed files with 27 additions and 1 deletions
@@ -88,8 +88,10 @@
expectingUpdate = true;
} else if (expectingUpdate) {
integrityReport = await getIntegrityReportSummary();
expectingUpdate = false;
}
await asyncTimeout(5000);
await asyncTimeout(2000);
}
});
@@ -1,12 +1,14 @@
<script lang="ts">
import AdminPageLayout from '$lib/components/layouts/AdminPageLayout.svelte';
import { AppRoute } from '$lib/constants';
import { asyncTimeout } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import {
createJob,
deleteIntegrityReport,
getBaseUrl,
getIntegrityReport,
getQueuesLegacy,
IntegrityReportType,
ManualJobName,
} from '@immich/sdk';
@@ -27,6 +29,7 @@
mdiPageFirst,
mdiTrashCanOutline,
} from '@mdi/js';
import { onDestroy, onMount } from 'svelte';
import { t } from 'svelte-i18n';
import { SvelteSet } from 'svelte/reactivity';
import type { PageData } from './$types';
@@ -137,6 +140,27 @@
],
});
};
let running = true;
let expectingUpdate = false;
onMount(async () => {
while (running) {
const jobs = await getQueuesLegacy();
if (jobs.integrityCheck.queueStatus.isActive) {
expectingUpdate = true;
} else if (expectingUpdate) {
await loadPage(page);
expectingUpdate = false;
}
await asyncTimeout(2000);
}
});
onDestroy(() => {
running = false;
});
</script>
<AdminPageLayout