Skip to content

Commit

Permalink
fix(server): offline assets don't restore when coming back online (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
zackpollard authored Oct 1, 2024
1 parent 49486f2 commit d46e502
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/src/services/library.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ export class LibraryService extends BaseService {
const handler = async () => {
this.logger.debug(`File add event received for ${path} in library ${library.id}}`);
if (matcher(path)) {
await this.syncFiles(library, [path]);
const asset = await this.assetRepository.getByLibraryIdAndOriginalPath(library.id, path);
if (asset) {
await this.syncAssets(library, [asset.id]);
}
if (matcher(path)) {
await this.syncFiles(library, [path]);
}
}
};
return handlePromiseError(handler(), this.logger);
Expand Down Expand Up @@ -604,7 +610,7 @@ export class LibraryService extends BaseService {
this.logger.log(`Scanning library ${library.id} for removed assets`);

const onlineAssets = usePagination(JOBS_LIBRARY_PAGINATION_SIZE, (pagination) =>
this.assetRepository.getAll(pagination, { libraryId: job.id }),
this.assetRepository.getAll(pagination, { libraryId: job.id, withDeleted: true }),
);

let assetCount = 0;
Expand Down

0 comments on commit d46e502

Please sign in to comment.