mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix watcher await
This commit is contained in:
@@ -46,7 +46,7 @@ export class LibraryService extends EventEmitter {
|
||||
private configCore: SystemConfigCore;
|
||||
private watchLibraries = false;
|
||||
private watchLock = false;
|
||||
private watchers: Record<string, () => void> = {};
|
||||
private watchers: Record<string, () => Promise<void>> = {};
|
||||
|
||||
constructor(
|
||||
@Inject(IAccessRepository) accessRepository: IAccessRepository,
|
||||
@@ -175,7 +175,7 @@ export class LibraryService extends EventEmitter {
|
||||
|
||||
async unwatch(id: string) {
|
||||
if (this.watchers[id]) {
|
||||
this.watchers[id]();
|
||||
await this.watchers[id]();
|
||||
delete this.watchers[id];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,6 @@ export interface IStorageRepository {
|
||||
crawl(crawlOptions: CrawlOptionsDto): Promise<string[]>;
|
||||
copyFile(source: string, target: string): Promise<void>;
|
||||
rename(source: string, target: string): Promise<void>;
|
||||
watch(paths: string[], options: WatchOptions, events: Partial<WatchEvents>): () => void;
|
||||
watch(paths: string[], options: WatchOptions, events: Partial<WatchEvents>): () => Promise<void>;
|
||||
utimes(filepath: string, atime: Date, mtime: Date): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -148,6 +148,6 @@ export class FilesystemProvider implements IStorageRepository {
|
||||
watcher.on(StorageEventType.UNLINK, (path) => events.onUnlink?.(path));
|
||||
watcher.on(StorageEventType.ERROR, (error) => events.onError?.(error));
|
||||
|
||||
return () => watcher.close();
|
||||
return async () => await watcher.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user