mirror of
https://github.com/immich-app/immich.git
synced 2025-01-10 13:56:47 +01:00
64636c0618
* duplicate detection job, entity, config * queueing * job panel, update api * use embedding in db instead of fetching * disable concurrency * only queue visible assets * handle multiple duplicateIds * update concurrent queue check * add provider * add web placeholder, server endpoint, migration, various fixes * update sql * select embedding by default * rename variable * simplify * remove separate entity, handle re-running with different threshold, set default back to 0.02 * fix tests * add tests * add index to entity * formatting * update asset mock * fix `upsertJobStatus` signature * update sql * formatting * default to 0.03 * optimize clustering * use asset's `duplicateId` if present * update sql * update tests * expose admin setting * refactor * formatting * skip if ml is disabled * debug trash e2e * remove from web * remove from sidebar * test if ml is disabled * update sql * separate duplicate detection from clip in config, disable by default for now * fix doc * lower minimum `maxDistance` * update api * Add and Use Duplicate Detection Feature Flag (#9364) * Add Duplicate Detection Flag * Use Duplicate Detection Flag * Attempt Fixes for Failing Checks * lower minimum `maxDistance` * fix tests --------- Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com> * chore: fixes and additions after rebase * chore: update api (remove new Role enum) * fix: left join smart search so getAll works without machine learning * test: trash e2e go back to checking length of assets is zero * chore: regen api after rebase * test: fix tests after rebase * redundant join --------- Co-authored-by: Nicholas Flamy <30300649+NicholasFlamy@users.noreply.github.com> Co-authored-by: Zack Pollard <zackpollard@ymail.com> Co-authored-by: Zack Pollard <zack@futo.org>
102 lines
6.3 KiB
TypeScript
102 lines
6.3 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { IDeleteFilesJob, JobName } from 'src/interfaces/job.interface';
|
|
import { AssetService } from 'src/services/asset.service';
|
|
import { AuditService } from 'src/services/audit.service';
|
|
import { DatabaseService } from 'src/services/database.service';
|
|
import { JobService } from 'src/services/job.service';
|
|
import { LibraryService } from 'src/services/library.service';
|
|
import { MediaService } from 'src/services/media.service';
|
|
import { MetadataService } from 'src/services/metadata.service';
|
|
import { NotificationService } from 'src/services/notification.service';
|
|
import { PersonService } from 'src/services/person.service';
|
|
import { SearchService } from 'src/services/search.service';
|
|
import { SessionService } from 'src/services/session.service';
|
|
import { SmartInfoService } from 'src/services/smart-info.service';
|
|
import { StorageTemplateService } from 'src/services/storage-template.service';
|
|
import { StorageService } from 'src/services/storage.service';
|
|
import { SystemConfigService } from 'src/services/system-config.service';
|
|
import { UserService } from 'src/services/user.service';
|
|
import { otelSDK } from 'src/utils/instrumentation';
|
|
|
|
@Injectable()
|
|
export class MicroservicesService {
|
|
constructor(
|
|
private auditService: AuditService,
|
|
private assetService: AssetService,
|
|
private configService: SystemConfigService,
|
|
private databaseService: DatabaseService,
|
|
private jobService: JobService,
|
|
private libraryService: LibraryService,
|
|
private mediaService: MediaService,
|
|
private metadataService: MetadataService,
|
|
private notificationService: NotificationService,
|
|
private personService: PersonService,
|
|
private smartInfoService: SmartInfoService,
|
|
private sessionService: SessionService,
|
|
private storageTemplateService: StorageTemplateService,
|
|
private storageService: StorageService,
|
|
private userService: UserService,
|
|
private searchService: SearchService,
|
|
) {}
|
|
|
|
async init() {
|
|
await this.databaseService.init();
|
|
await this.configService.init();
|
|
await this.libraryService.init();
|
|
await this.notificationService.init();
|
|
await this.jobService.init({
|
|
[JobName.ASSET_DELETION]: (data) => this.assetService.handleAssetDeletion(data),
|
|
[JobName.ASSET_DELETION_CHECK]: () => this.assetService.handleAssetDeletionCheck(),
|
|
[JobName.DELETE_FILES]: (data: IDeleteFilesJob) => this.storageService.handleDeleteFiles(data),
|
|
[JobName.CLEAN_OLD_AUDIT_LOGS]: () => this.auditService.handleCleanup(),
|
|
[JobName.CLEAN_OLD_SESSION_TOKENS]: () => this.sessionService.handleCleanup(),
|
|
[JobName.USER_DELETE_CHECK]: () => this.userService.handleUserDeleteCheck(),
|
|
[JobName.USER_DELETION]: (data) => this.userService.handleUserDelete(data),
|
|
[JobName.USER_SYNC_USAGE]: () => this.userService.handleUserSyncUsage(),
|
|
[JobName.QUEUE_SMART_SEARCH]: (data) => this.smartInfoService.handleQueueEncodeClip(data),
|
|
[JobName.SMART_SEARCH]: (data) => this.smartInfoService.handleEncodeClip(data),
|
|
[JobName.QUEUE_DUPLICATE_DETECTION]: (data) => this.searchService.handleQueueSearchDuplicates(data),
|
|
[JobName.DUPLICATE_DETECTION]: (data) => this.searchService.handleSearchDuplicates(data),
|
|
[JobName.STORAGE_TEMPLATE_MIGRATION]: () => this.storageTemplateService.handleMigration(),
|
|
[JobName.STORAGE_TEMPLATE_MIGRATION_SINGLE]: (data) => this.storageTemplateService.handleMigrationSingle(data),
|
|
[JobName.QUEUE_MIGRATION]: () => this.mediaService.handleQueueMigration(),
|
|
[JobName.MIGRATE_ASSET]: (data) => this.mediaService.handleAssetMigration(data),
|
|
[JobName.MIGRATE_PERSON]: (data) => this.personService.handlePersonMigration(data),
|
|
[JobName.QUEUE_GENERATE_THUMBNAILS]: (data) => this.mediaService.handleQueueGenerateThumbnails(data),
|
|
[JobName.GENERATE_PREVIEW]: (data) => this.mediaService.handleGeneratePreview(data),
|
|
[JobName.GENERATE_THUMBNAIL]: (data) => this.mediaService.handleGenerateThumbnail(data),
|
|
[JobName.GENERATE_THUMBHASH]: (data) => this.mediaService.handleGenerateThumbhash(data),
|
|
[JobName.QUEUE_VIDEO_CONVERSION]: (data) => this.mediaService.handleQueueVideoConversion(data),
|
|
[JobName.VIDEO_CONVERSION]: (data) => this.mediaService.handleVideoConversion(data),
|
|
[JobName.QUEUE_METADATA_EXTRACTION]: (data) => this.metadataService.handleQueueMetadataExtraction(data),
|
|
[JobName.METADATA_EXTRACTION]: (data) => this.metadataService.handleMetadataExtraction(data),
|
|
[JobName.LINK_LIVE_PHOTOS]: (data) => this.metadataService.handleLivePhotoLinking(data),
|
|
[JobName.QUEUE_FACE_DETECTION]: (data) => this.personService.handleQueueDetectFaces(data),
|
|
[JobName.FACE_DETECTION]: (data) => this.personService.handleDetectFaces(data),
|
|
[JobName.QUEUE_FACIAL_RECOGNITION]: (data) => this.personService.handleQueueRecognizeFaces(data),
|
|
[JobName.FACIAL_RECOGNITION]: (data) => this.personService.handleRecognizeFaces(data),
|
|
[JobName.GENERATE_PERSON_THUMBNAIL]: (data) => this.personService.handleGeneratePersonThumbnail(data),
|
|
[JobName.PERSON_CLEANUP]: () => this.personService.handlePersonCleanup(),
|
|
[JobName.QUEUE_SIDECAR]: (data) => this.metadataService.handleQueueSidecar(data),
|
|
[JobName.SIDECAR_DISCOVERY]: (data) => this.metadataService.handleSidecarDiscovery(data),
|
|
[JobName.SIDECAR_SYNC]: (data) => this.metadataService.handleSidecarSync(data),
|
|
[JobName.SIDECAR_WRITE]: (data) => this.metadataService.handleSidecarWrite(data),
|
|
[JobName.LIBRARY_SCAN_ASSET]: (data) => this.libraryService.handleAssetRefresh(data),
|
|
[JobName.LIBRARY_SCAN]: (data) => this.libraryService.handleQueueAssetRefresh(data),
|
|
[JobName.LIBRARY_DELETE]: (data) => this.libraryService.handleDeleteLibrary(data),
|
|
[JobName.LIBRARY_REMOVE_OFFLINE]: (data) => this.libraryService.handleOfflineRemoval(data),
|
|
[JobName.LIBRARY_QUEUE_SCAN_ALL]: (data) => this.libraryService.handleQueueAllScan(data),
|
|
[JobName.LIBRARY_QUEUE_CLEANUP]: () => this.libraryService.handleQueueCleanup(),
|
|
[JobName.SEND_EMAIL]: (data) => this.notificationService.handleSendEmail(data),
|
|
[JobName.NOTIFY_SIGNUP]: (data) => this.notificationService.handleUserSignup(data),
|
|
});
|
|
|
|
await this.metadataService.init();
|
|
}
|
|
|
|
async teardown() {
|
|
await this.libraryService.teardown();
|
|
await this.metadataService.teardown();
|
|
await otelSDK.shutdown();
|
|
}
|
|
}
|