job
This commit is contained in:
parent
3c3de8b2af
commit
37b4f8455b
8 changed files with 54 additions and 4 deletions
|
@ -5024,6 +5024,9 @@
|
|||
"sidecar": {
|
||||
"$ref": "#/components/schemas/JobStatusDto"
|
||||
},
|
||||
"smartAlbum": {
|
||||
"$ref": "#/components/schemas/JobStatusDto"
|
||||
},
|
||||
"storageTemplateMigration": {
|
||||
"$ref": "#/components/schemas/JobStatusDto"
|
||||
},
|
||||
|
@ -5044,7 +5047,8 @@
|
|||
"backgroundTask",
|
||||
"search",
|
||||
"recognizeFaces",
|
||||
"sidecar"
|
||||
"sidecar",
|
||||
"smartAlbum"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
|
@ -6344,7 +6348,8 @@
|
|||
"backgroundTask",
|
||||
"storageTemplateMigration",
|
||||
"search",
|
||||
"sidecar"
|
||||
"sidecar",
|
||||
"smartAlbum"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -7478,6 +7483,9 @@
|
|||
"sidecar": {
|
||||
"$ref": "#/components/schemas/JobSettingsDto"
|
||||
},
|
||||
"smartAlbum": {
|
||||
"$ref": "#/components/schemas/JobSettingsDto"
|
||||
},
|
||||
"storageTemplateMigration": {
|
||||
"$ref": "#/components/schemas/JobSettingsDto"
|
||||
},
|
||||
|
@ -7498,7 +7506,8 @@
|
|||
"backgroundTask",
|
||||
"search",
|
||||
"recognizeFaces",
|
||||
"sidecar"
|
||||
"sidecar",
|
||||
"smartAlbum"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
|
|
|
@ -9,6 +9,7 @@ export enum QueueName {
|
|||
STORAGE_TEMPLATE_MIGRATION = 'storageTemplateMigration',
|
||||
SEARCH = 'search',
|
||||
SIDECAR = 'sidecar',
|
||||
SMART_ALBUM = 'smartAlbum',
|
||||
}
|
||||
|
||||
export enum JobCommand {
|
||||
|
@ -74,6 +75,10 @@ export enum JobName {
|
|||
QUEUE_SIDECAR = 'queue-sidecar',
|
||||
SIDECAR_DISCOVERY = 'sidecar-discovery',
|
||||
SIDECAR_SYNC = 'sidecar-sync',
|
||||
|
||||
// smart albums
|
||||
SMART_ALBUM_INDEX = 'smart-album-index',
|
||||
SMART_ALBUM_INSERT = 'smart-album-insert',
|
||||
}
|
||||
|
||||
export const JOBS_ASSET_PAGINATION_SIZE = 1000;
|
||||
|
@ -136,4 +141,8 @@ export const JOBS_TO_QUEUE: Record<JobName, QueueName> = {
|
|||
[JobName.QUEUE_SIDECAR]: QueueName.SIDECAR,
|
||||
[JobName.SIDECAR_DISCOVERY]: QueueName.SIDECAR,
|
||||
[JobName.SIDECAR_SYNC]: QueueName.SIDECAR,
|
||||
|
||||
// smart albums
|
||||
[JobName.SMART_ALBUM_INDEX]: QueueName.SMART_ALBUM,
|
||||
[JobName.SMART_ALBUM_INSERT]: QueueName.SMART_ALBUM,
|
||||
};
|
||||
|
|
|
@ -78,4 +78,7 @@ export class AllJobStatusResponseDto implements Record<QueueName, JobStatusDto>
|
|||
|
||||
@ApiProperty({ type: JobStatusDto })
|
||||
[QueueName.SIDECAR]!: JobStatusDto;
|
||||
|
||||
@ApiProperty({ type: JobStatusDto })
|
||||
[QueueName.SMART_ALBUM]!: JobStatusDto;
|
||||
}
|
||||
|
|
|
@ -29,3 +29,13 @@ export interface IBulkEntityJob extends IBaseJob {
|
|||
export interface IDeleteFilesJob extends IBaseJob {
|
||||
files: Array<string | null | undefined>;
|
||||
}
|
||||
|
||||
export interface ISmartAlbumIndexJob extends IBaseJob {
|
||||
albumId: string;
|
||||
ruleId: string;
|
||||
}
|
||||
|
||||
export interface ISmartAlbumInsertJob extends IBaseJob {
|
||||
albumId: string;
|
||||
assetId: string;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import {
|
|||
IDeleteFilesJob,
|
||||
IEntityJob,
|
||||
IFaceThumbnailJob,
|
||||
ISmartAlbumIndexJob,
|
||||
ISmartAlbumInsertJob,
|
||||
} from './job.interface';
|
||||
|
||||
export interface JobCounts {
|
||||
|
@ -79,7 +81,11 @@ export type JobItem =
|
|||
| { name: JobName.SEARCH_INDEX_ALBUM; data: IBulkEntityJob }
|
||||
| { name: JobName.SEARCH_REMOVE_ASSET; data: IBulkEntityJob }
|
||||
| { name: JobName.SEARCH_REMOVE_ALBUM; data: IBulkEntityJob }
|
||||
| { name: JobName.SEARCH_REMOVE_FACE; data: IAssetFaceJob };
|
||||
| { name: JobName.SEARCH_REMOVE_FACE; data: IAssetFaceJob }
|
||||
|
||||
// Smart album
|
||||
| { name: JobName.SMART_ALBUM_INDEX; data: ISmartAlbumIndexJob }
|
||||
| { name: JobName.SMART_ALBUM_INSERT; data: ISmartAlbumInsertJob };
|
||||
|
||||
export type JobHandler<T = any> = (data: T) => boolean | Promise<boolean>;
|
||||
|
||||
|
|
|
@ -70,4 +70,10 @@ export class SystemConfigJobDto implements Record<QueueName, JobSettingsDto> {
|
|||
@IsObject()
|
||||
@Type(() => JobSettingsDto)
|
||||
[QueueName.SIDECAR]!: JobSettingsDto;
|
||||
|
||||
@ApiProperty({ type: JobSettingsDto })
|
||||
@ValidateNested()
|
||||
@IsObject()
|
||||
@Type(() => JobSettingsDto)
|
||||
[QueueName.SMART_ALBUM]!: JobSettingsDto;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ export const defaults = Object.freeze<SystemConfig>({
|
|||
[QueueName.STORAGE_TEMPLATE_MIGRATION]: { concurrency: 5 },
|
||||
[QueueName.THUMBNAIL_GENERATION]: { concurrency: 5 },
|
||||
[QueueName.VIDEO_CONVERSION]: { concurrency: 1 },
|
||||
[QueueName.SMART_ALBUM]: { concurrency: 1 },
|
||||
},
|
||||
oauth: {
|
||||
enabled: false,
|
||||
|
|
|
@ -73,6 +73,12 @@ export class AppService {
|
|||
[JobName.QUEUE_SIDECAR]: (data) => this.metadataService.handleQueueSidecar(data),
|
||||
[JobName.SIDECAR_DISCOVERY]: (data) => this.metadataService.handleSidecarDiscovery(data),
|
||||
[JobName.SIDECAR_SYNC]: () => this.metadataService.handleSidecarSync(),
|
||||
[JobName.SMART_ALBUM_INDEX]: (data) => {
|
||||
throw new Error('Not implemented SMART_ALBUM_INDEX');
|
||||
},
|
||||
[JobName.SMART_ALBUM_INSERT]: (data) => {
|
||||
throw new Error('Not implemented SMART_ALBUM_INSERT');
|
||||
},
|
||||
});
|
||||
|
||||
process.on('uncaughtException', (error: Error | any) => {
|
||||
|
|
Loading…
Reference in a new issue