Skip to content

Commit

Permalink
fix: migration tool should just migrate all images with descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bensandee committed Feb 22, 2024
1 parent c1b68d8 commit 04d23b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tools/updatefilemetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ if (require.main === module) {

const fs = container.resolve(FilesystemRepository);

return updateFileMetadata(fs);
await updateFileMetadata(fs);

await db.stop();
return db.stop();
})
.catch((error) => {
console.log(error);
Expand All @@ -25,13 +25,14 @@ if (require.main === module) {

export const updateFileMetadata = async (fs: FilesystemRepository) => {
logger.info("Looking for images with description_from_exif set to false");
const images = await Image.find({ description_from_exif: { $eq: false } });
const images = await Image.find();
logger.info(`Found ${images.length} images`);

const limit = pLimit(4);

const promises = images
.filter((image) => image.deleted === false)
.filter((image) => image.description != null && image.description !== "")
.map((image) =>
limit(async () => {
const base = image.filename;
Expand Down

0 comments on commit 04d23b5

Please sign in to comment.