1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Fixing job progress freshness

This commit is contained in:
Patrik J. Braun 2022-12-05 19:37:15 +01:00
parent d75a307be6
commit 79903c8182

View File

@ -103,13 +103,19 @@ export class ScheduledJobsService {
}
}
protected isAnyJobRunning(): boolean {
return Object.values(this.progress.value)
.findIndex(p => p.state === JobProgressStates.running ||
p.state === JobProgressStates.cancelling) !== -1;
}
protected getProgressPeriodically(): void {
if (this.timer != null || this.subscribers === 0) {
return;
}
let repeatTime = 5000;
if (Object.values(this.progress.value).length === 0) {
repeatTime = 10000;
if (!this.isAnyJobRunning()) {
repeatTime = 15000;
}
this.timer = window.setTimeout(async () => {
this.timer = null;