mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: reload tables if job queue empties
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user