Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): offline assets don't restore when coming back online #13087

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading