fixed mem leak

This commit is contained in:
Nebel 2023-12-02 15:42:53 +09:00
parent e1da7c92d7
commit f6d411e996
Signed by: nebel
GPG key ID: 79807D08C6EF6460

View file

@ -103,8 +103,6 @@ const options = {
async run() {
const db = await createDatabase(args.values.db!);
const library = createLibrary(db);
const browser = await chromium.launch();
const platform = createPlatform({ db, browser });
const books: Array<Book> = [];
if (args.values.download === "all") {
@ -124,12 +122,13 @@ const options = {
}
for (const book of books) {
const browser = await chromium.launch();
const platform = createPlatform({ db, browser });
const dir = `${args.values["out-dir"]!}/${book.id}`;
await platform.download(dir, book);
await library.archive(dir, args.values["out-dir"]!, book);
await browser.close();
}
await browser.close();
},
},
json: {