1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

set exiftool maxProcs

This commit is contained in:
mertalev 2024-11-21 01:44:21 -05:00
parent 03dffc8414
commit ba10bf7628
No known key found for this signature in database
GPG key ID: 3A2B5BFC678DBC80
3 changed files with 15 additions and 0 deletions

View file

@ -64,6 +64,7 @@ export interface ImmichTags extends Omit<Tags, TagsWithWrongTypes> {
} }
export interface IMetadataRepository { export interface IMetadataRepository {
setMaxConcurrency(concurrency: number): void;
teardown(): Promise<void>; teardown(): Promise<void>;
readTags(path: string): Promise<ImmichTags>; readTags(path: string): Promise<ImmichTags>;
writeTags(path: string, tags: Partial<Tags>): Promise<void>; writeTags(path: string, tags: Partial<Tags>): Promise<void>;

View file

@ -24,6 +24,10 @@ export class MetadataRepository implements IMetadataRepository {
this.logger.setContext(MetadataRepository.name); this.logger.setContext(MetadataRepository.name);
} }
setMaxConcurrency(concurrency: number) {
this.exiftool.batchCluster.setMaxProcs(concurrency);
}
async teardown() { async teardown() {
await this.exiftool.end(); await this.exiftool.end();
} }

View file

@ -80,6 +80,16 @@ export class MetadataService extends BaseService {
await this.metadataRepository.teardown(); await this.metadataRepository.teardown();
} }
@OnEvent({ name: 'config.init', workers: [ImmichWorker.MICROSERVICES] })
onConfigInit({ newConfig }: ArgOf<'config.init'>) {
this.metadataRepository.setMaxConcurrency(newConfig.job.metadataExtraction.concurrency);
}
@OnEvent({ name: 'config.update', workers: [ImmichWorker.MICROSERVICES], server: true })
onConfigUpdate({ newConfig }: ArgOf<'config.update'>) {
this.metadataRepository.setMaxConcurrency(newConfig.job.metadataExtraction.concurrency);
}
private async init() { private async init() {
this.logger.log('Initializing metadata service'); this.logger.log('Initializing metadata service');