mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-08 12:19:05 +00:00
refactor(server): jobs and processors (#1787)
* refactor: jobs and processors * refactor: storage migration processor * fix: tests * fix: code warning * chore: ignore coverage from infra * fix: sync move asset logic between job core and asset core * refactor: move error handling inside of catch * refactor(server): job core into dedicated service calls * refactor: smart info * fix: tests * chore: smart info tests * refactor: use asset repository * refactor: thumbnail processor * chore: coverage reqs
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
import {
|
||||
IAssetUploadedJob,
|
||||
IDeleteFileOnDiskJob,
|
||||
IExifExtractionProcessor,
|
||||
IMachineLearningJob,
|
||||
IVideoConversionProcessor,
|
||||
IReverseGeocodingProcessor,
|
||||
IUserDeletionJob,
|
||||
IVideoLengthExtractionProcessor,
|
||||
JpegGeneratorProcessor,
|
||||
WebpGeneratorProcessor,
|
||||
} from './interfaces';
|
||||
import { JobName, QueueName } from './job.constants';
|
||||
import { IAssetJob, IAssetUploadedJob, IDeleteFilesJob, IReverseGeocodingJob, IUserDeletionJob } from './job.interface';
|
||||
|
||||
export interface JobCounts {
|
||||
active: number;
|
||||
@@ -20,30 +9,27 @@ export interface JobCounts {
|
||||
waiting: number;
|
||||
}
|
||||
|
||||
export interface Job<T> {
|
||||
data: T;
|
||||
}
|
||||
|
||||
export type JobItem =
|
||||
| { name: JobName.ASSET_UPLOADED; data: IAssetUploadedJob }
|
||||
| { name: JobName.VIDEO_CONVERSION; data: IVideoConversionProcessor }
|
||||
| { name: JobName.GENERATE_JPEG_THUMBNAIL; data: JpegGeneratorProcessor }
|
||||
| { name: JobName.GENERATE_WEBP_THUMBNAIL; data: WebpGeneratorProcessor }
|
||||
| { name: JobName.EXIF_EXTRACTION; data: IExifExtractionProcessor }
|
||||
| { name: JobName.REVERSE_GEOCODING; data: IReverseGeocodingProcessor }
|
||||
| { name: JobName.VIDEO_CONVERSION; data: IAssetJob }
|
||||
| { name: JobName.GENERATE_JPEG_THUMBNAIL; data: IAssetJob }
|
||||
| { name: JobName.GENERATE_WEBP_THUMBNAIL; data: IAssetJob }
|
||||
| { name: JobName.EXIF_EXTRACTION; data: IAssetUploadedJob }
|
||||
| { name: JobName.REVERSE_GEOCODING; data: IReverseGeocodingJob }
|
||||
| { name: JobName.USER_DELETE_CHECK }
|
||||
| { name: JobName.USER_DELETION; data: IUserDeletionJob }
|
||||
| { name: JobName.TEMPLATE_MIGRATION }
|
||||
| { name: JobName.CONFIG_CHANGE }
|
||||
| { name: JobName.EXTRACT_VIDEO_METADATA; data: IVideoLengthExtractionProcessor }
|
||||
| { name: JobName.OBJECT_DETECTION; data: IMachineLearningJob }
|
||||
| { name: JobName.IMAGE_TAGGING; data: IMachineLearningJob }
|
||||
| { name: JobName.DELETE_FILE_ON_DISK; data: IDeleteFileOnDiskJob };
|
||||
| { name: JobName.STORAGE_TEMPLATE_MIGRATION }
|
||||
| { name: JobName.SYSTEM_CONFIG_CHANGE }
|
||||
| { name: JobName.EXTRACT_VIDEO_METADATA; data: IAssetUploadedJob }
|
||||
| { name: JobName.OBJECT_DETECTION; data: IAssetJob }
|
||||
| { name: JobName.IMAGE_TAGGING; data: IAssetJob }
|
||||
| { name: JobName.DELETE_FILES; data: IDeleteFilesJob };
|
||||
|
||||
export const IJobRepository = 'IJobRepository';
|
||||
|
||||
export interface IJobRepository {
|
||||
queue(item: JobItem): Promise<void>;
|
||||
empty(name: QueueName): Promise<void>;
|
||||
add(item: JobItem): Promise<void>;
|
||||
isActive(name: QueueName): Promise<boolean>;
|
||||
getJobCounts(name: QueueName): Promise<JobCounts>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user