diff --git a/server/utils/parsers/parseComicMetadata.js b/server/utils/parsers/parseComicMetadata.js index 3f6c3fb7..77e5ec2a 100644 --- a/server/utils/parsers/parseComicMetadata.js +++ b/server/utils/parsers/parseComicMetadata.js @@ -50,6 +50,9 @@ async function extractCoverImage(comicPath, comicImageFilepath, outputCoverPath) } catch (error) { Logger.error(`[parseComicMetadata] Failed to extract image from comicPath "${comicPath}"`, error) return false + } finally { + // Ensure we free the memory + archive.close() } } module.exports.extractCoverImage = extractCoverImage @@ -104,6 +107,9 @@ async function parse(ebookFile) { Logger.warn(`Cover image not found in comic at "${comicPath}"`) } + // Ensure we close the archive to free memory + archive.close() + return payload } module.exports.parse = parse