From eda9e580c9dbc4489a7954653a7414502b79dd85 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Wed, 29 Mar 2023 17:33:03 +0200 Subject: [PATCH] fix(server): add paused property to JobCountsDto (#2112) --- mobile/openapi/doc/JobCountsDto.md | Bin 518 -> 545 bytes mobile/openapi/lib/model/job_counts_dto.dart | Bin 4202 -> 4420 bytes mobile/openapi/test/job_counts_dto_test.dart | Bin 939 -> 1033 bytes server/immich-openapi-specs.json | 6 +- server/libs/domain/src/job/job.repository.ts | 1 + .../libs/domain/src/job/job.service.spec.ts | 9 +++ .../all-job-status-response.dto.ts | 2 + server/libs/infra/src/job/job.repository.ts | 6 +- server/package-lock.json | 59 +----------------- server/package.json | 1 - web/src/api/open-api/api.ts | 6 ++ 11 files changed, 28 insertions(+), 62 deletions(-) diff --git a/mobile/openapi/doc/JobCountsDto.md b/mobile/openapi/doc/JobCountsDto.md index c4987e5013ce87cfea7ddafe8ed459825e72a9bb..8f5b47c6f1cc6faeef05c67c21ec0b4fb20df11a 100644 GIT binary patch delta 22 dcmZo;S;(>>k&#VHt01woc(MVb=;TDkr2tIq2FL&a delta 11 ScmZ3;(#EnOk#TYj<5B<@b_4eS diff --git a/mobile/openapi/lib/model/job_counts_dto.dart b/mobile/openapi/lib/model/job_counts_dto.dart index 41174e57a7dc5c881add82c31d5d5da3f9f7597c..80fa124224086de1ebd8e8dd885f8b057657d7fd 100644 GIT binary patch delta 210 zcmaE*a71atUq&$ng`(8L(#)dN6orzE%woNQ#M0u_l*vCCqq#EkN)#a6&Hha6jPeR< zYFr8+kYAFKS_D<8U~3CiG&zj<7@vYRScwMI7$KHv0ymq0?g=-oN{bX-C|sRY$6H@Fnu~e`)aMZYPq-o0Ww3S delta 46 zcmX@2^h#mFU&hJeOyQernV1+S&tpC|xrU`@vjnRMS1lI+^Ysd% delta 11 ScmeC=Sk1m+A@k(_%v=B(cLX;8 diff --git a/server/immich-openapi-specs.json b/server/immich-openapi-specs.json index 41faf6d750..2c1bacceb5 100644 --- a/server/immich-openapi-specs.json +++ b/server/immich-openapi-specs.json @@ -4074,6 +4074,9 @@ }, "waiting": { "type": "integer" + }, + "paused": { + "type": "integer" } }, "required": [ @@ -4081,7 +4084,8 @@ "completed", "failed", "delayed", - "waiting" + "waiting", + "paused" ] }, "AllJobStatusResponseDto": { diff --git a/server/libs/domain/src/job/job.repository.ts b/server/libs/domain/src/job/job.repository.ts index 0adea7289f..fbbc02fb6d 100644 --- a/server/libs/domain/src/job/job.repository.ts +++ b/server/libs/domain/src/job/job.repository.ts @@ -15,6 +15,7 @@ export interface JobCounts { failed: number; delayed: number; waiting: number; + paused: number; } export type JobItem = diff --git a/server/libs/domain/src/job/job.service.spec.ts b/server/libs/domain/src/job/job.service.spec.ts index 9129b0a183..a07e779c97 100644 --- a/server/libs/domain/src/job/job.service.spec.ts +++ b/server/libs/domain/src/job/job.service.spec.ts @@ -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, }, }); }); diff --git a/server/libs/domain/src/job/response-dto/all-job-status-response.dto.ts b/server/libs/domain/src/job/response-dto/all-job-status-response.dto.ts index 09bb55c307..dd0d1fb65a 100644 --- a/server/libs/domain/src/job/response-dto/all-job-status-response.dto.ts +++ b/server/libs/domain/src/job/response-dto/all-job-status-response.dto.ts @@ -12,6 +12,8 @@ export class JobCountsDto { delayed!: number; @ApiProperty({ type: 'integer' }) waiting!: number; + @ApiProperty({ type: 'integer' }) + paused!: number; } export class AllJobStatusResponseDto implements Record { diff --git a/server/libs/infra/src/job/job.repository.ts b/server/libs/infra/src/job/job.repository.ts index b3117d878d..cf39d324cc 100644 --- a/server/libs/infra/src/job/job.repository.ts +++ b/server/libs/infra/src/job/job.repository.ts @@ -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 { - 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; } async queue(item: JobItem): Promise { diff --git a/server/package-lock.json b/server/package-lock.json index 44c1466c5b..a1f8324b95 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "immich", - "version": "1.51.0", + "version": "1.52.0", "license": "UNLICENSED", "dependencies": { "@babel/runtime": "^7.20.13", @@ -60,7 +60,6 @@ "@openapitools/openapi-generator-cli": "2.5.1", "@types/archiver": "^5.3.1", "@types/bcrypt": "^5.0.0", - "@types/bull": "^3.15.9", "@types/cookie-parser": "^1.4.3", "@types/cron": "^2.0.0", "@types/express": "^4.17.13", @@ -2511,16 +2510,6 @@ "@types/node": "*" } }, - "node_modules/@types/bull": { - "version": "3.15.9", - "resolved": "https://registry.npmjs.org/@types/bull/-/bull-3.15.9.tgz", - "integrity": "sha512-MPUcyPPQauAmynoO3ezHAmCOhbB0pWmYyijr/5ctaCqhbKWsjW0YCod38ZcLzUBprosfZ9dPqfYIcfdKjk7RNQ==", - "dev": true, - "dependencies": { - "@types/ioredis": "*", - "@types/redis": "^2.8.0" - } - }, "node_modules/@types/component-emitter": { "version": "1.2.11", "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz", @@ -2671,15 +2660,6 @@ "@types/through": "*" } }, - "node_modules/@types/ioredis": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/@types/ioredis/-/ioredis-4.28.8.tgz", - "integrity": "sha512-mULOyO2smtvkE1zmzRRA4P0+1UjEqusi014kXOL1q3CY0RgqkR5/wKvv+vAJbPw2Q66wPyylKeevUy+m/FaRMg==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -2801,15 +2781,6 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, - "node_modules/@types/redis": { - "version": "2.8.32", - "resolved": "https://registry.npmjs.org/@types/redis/-/redis-2.8.32.tgz", - "integrity": "sha512-7jkMKxcGq9p242exlbsVzuJb57KqHRhNl4dHoQu2Y5v9bCAbtIXXH0R3HleSQW4CTOqpHIYUW3t6tpUj4BVQ+w==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -13471,16 +13442,6 @@ "@types/node": "*" } }, - "@types/bull": { - "version": "3.15.9", - "resolved": "https://registry.npmjs.org/@types/bull/-/bull-3.15.9.tgz", - "integrity": "sha512-MPUcyPPQauAmynoO3ezHAmCOhbB0pWmYyijr/5ctaCqhbKWsjW0YCod38ZcLzUBprosfZ9dPqfYIcfdKjk7RNQ==", - "dev": true, - "requires": { - "@types/ioredis": "*", - "@types/redis": "^2.8.0" - } - }, "@types/component-emitter": { "version": "1.2.11", "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz", @@ -13631,15 +13592,6 @@ "@types/through": "*" } }, - "@types/ioredis": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/@types/ioredis/-/ioredis-4.28.8.tgz", - "integrity": "sha512-mULOyO2smtvkE1zmzRRA4P0+1UjEqusi014kXOL1q3CY0RgqkR5/wKvv+vAJbPw2Q66wPyylKeevUy+m/FaRMg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -13761,15 +13713,6 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, - "@types/redis": { - "version": "2.8.32", - "resolved": "https://registry.npmjs.org/@types/redis/-/redis-2.8.32.tgz", - "integrity": "sha512-7jkMKxcGq9p242exlbsVzuJb57KqHRhNl4dHoQu2Y5v9bCAbtIXXH0R3HleSQW4CTOqpHIYUW3t6tpUj4BVQ+w==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", diff --git a/server/package.json b/server/package.json index 51b0d87359..866df2a93c 100644 --- a/server/package.json +++ b/server/package.json @@ -88,7 +88,6 @@ "@openapitools/openapi-generator-cli": "2.5.1", "@types/archiver": "^5.3.1", "@types/bcrypt": "^5.0.0", - "@types/bull": "^3.15.9", "@types/cookie-parser": "^1.4.3", "@types/cron": "^2.0.0", "@types/express": "^4.17.13", diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.ts index 6158caec76..0d3d56b055 100644 --- a/web/src/api/open-api/api.ts +++ b/web/src/api/open-api/api.ts @@ -1284,6 +1284,12 @@ export interface JobCountsDto { * @memberof JobCountsDto */ 'waiting': number; + /** + * + * @type {number} + * @memberof JobCountsDto + */ + 'paused': number; } /** *