mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-08 20:29:05 +00:00
fix(server): add paused property to JobCountsDto (#2112)
This commit is contained in:
@@ -15,6 +15,7 @@ export interface JobCounts {
|
||||
failed: number;
|
||||
delayed: number;
|
||||
waiting: number;
|
||||
paused: number;
|
||||
}
|
||||
|
||||
export type JobItem =
|
||||
|
||||
@@ -23,6 +23,7 @@ describe(JobService.name, () => {
|
||||
failed: 1,
|
||||
delayed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
});
|
||||
|
||||
await expect(sut.getAllJobsStatus()).resolves.toEqual({
|
||||
@@ -32,6 +33,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'clip-encoding-queue': {
|
||||
active: 1,
|
||||
@@ -39,6 +41,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'metadata-extraction-queue': {
|
||||
active: 1,
|
||||
@@ -46,6 +49,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'object-tagging-queue': {
|
||||
active: 1,
|
||||
@@ -53,6 +57,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'search-queue': {
|
||||
active: 1,
|
||||
@@ -60,6 +65,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'storage-template-migration-queue': {
|
||||
active: 1,
|
||||
@@ -67,6 +73,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'thumbnail-generation-queue': {
|
||||
active: 1,
|
||||
@@ -74,6 +81,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
'video-conversion-queue': {
|
||||
active: 1,
|
||||
@@ -81,6 +89,7 @@ describe(JobService.name, () => {
|
||||
delayed: 1,
|
||||
failed: 1,
|
||||
waiting: 1,
|
||||
paused: 1,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,6 +12,8 @@ export class JobCountsDto {
|
||||
delayed!: number;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
waiting!: number;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
paused!: number;
|
||||
}
|
||||
|
||||
export class AllJobStatusResponseDto implements Record<QueueName, JobCountsDto> {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from '@app/domain';
|
||||
import { InjectQueue } from '@nestjs/bull';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { Queue } from 'bull';
|
||||
import { Queue, type JobCounts as BullJobCounts } from 'bull';
|
||||
|
||||
export class JobRepository implements IJobRepository {
|
||||
private logger = new Logger(JobRepository.name);
|
||||
@@ -54,7 +54,9 @@ export class JobRepository implements IJobRepository {
|
||||
}
|
||||
|
||||
getJobCounts(name: QueueName): Promise<JobCounts> {
|
||||
return this.queueMap[name].getJobCounts();
|
||||
// Typecast needed because the `paused` key is missing from Bull's
|
||||
// type definition. Can be removed once fixed upstream.
|
||||
return this.queueMap[name].getJobCounts() as Promise<BullJobCounts & { paused: number }>;
|
||||
}
|
||||
|
||||
async queue(item: JobItem): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user