From 6755c25488edccbeb34bcb9b60153d5808aa6be7 Mon Sep 17 00:00:00 2001 From: victornpb <3372598+victornpb@users.noreply.github.com> Date: Sun, 15 May 2022 20:52:14 -0300 Subject: [PATCH] 0.0.9 --- dist/action.mjs | 14 +++++++++----- dist/cli.mjs | 16 ++++++++++------ package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/dist/action.mjs b/dist/action.mjs index 6cff5ec6..5ed3a0fa 100644 --- a/dist/action.mjs +++ b/dist/action.mjs @@ -1,5 +1,5 @@ /*! - * NotionJAM v0.0.8 (https://github.com/victornpb/notion-jam) + * NotionJAM v0.0.9 (https://github.com/victornpb/notion-jam) * Copyright (c) victornpb * @license UNLICENSED */ @@ -238,7 +238,7 @@ function plugin$1(frontmatter) { function parallel(items, handler, concurrency) { if (!Number.isInteger(concurrency) || concurrency < 1) throw new Error('concurrency must be a positive integer greater than 0'); - + if (items.length === 0) return Promise.resolve([]); return new Promise((resolve, reject) => { const results = []; let i = 0; @@ -246,13 +246,17 @@ function parallel(items, handler, concurrency) { const next = (result) => { results.push(result); if (i < items.length) { - handler(items[i++]).then(next).catch(reject); + try { + handler(items[i++]).then(next).catch(reject); + } catch (err) { reject(err); } } else if (results.length === items.length) resolve(results); }; for (let x = 0; x < Math.min(concurrency, items.length); x++) { - handler(items[i++]).then(next).catch(reject); + try { + handler(items[i++]).then(next).catch(reject); + } catch (err) { reject(err); break; } } }); } @@ -562,7 +566,7 @@ async function run(options) { filterValues: 'Ready,Published', caseType: 'snake', - parallelPages: 3, + parallelPages: 25, parallelDownloadsPerPage: 3, downloadImageTimeout: 30, skipDownloadedImages: true, diff --git a/dist/cli.mjs b/dist/cli.mjs index 3fef1c2f..40d63403 100755 --- a/dist/cli.mjs +++ b/dist/cli.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node /*! - * NotionJAM v0.0.8 (https://github.com/victornpb/notion-jam) + * NotionJAM v0.0.9 (https://github.com/victornpb/notion-jam) * Copyright (c) victornpb * @license UNLICENSED */ @@ -239,7 +239,7 @@ function plugin$1(frontmatter) { function parallel(items, handler, concurrency) { if (!Number.isInteger(concurrency) || concurrency < 1) throw new Error('concurrency must be a positive integer greater than 0'); - + if (items.length === 0) return Promise.resolve([]); return new Promise((resolve, reject) => { const results = []; let i = 0; @@ -247,13 +247,17 @@ function parallel(items, handler, concurrency) { const next = (result) => { results.push(result); if (i < items.length) { - handler(items[i++]).then(next).catch(reject); + try { + handler(items[i++]).then(next).catch(reject); + } catch (err) { reject(err); } } else if (results.length === items.length) resolve(results); }; for (let x = 0; x < Math.min(concurrency, items.length); x++) { - handler(items[i++]).then(next).catch(reject); + try { + handler(items[i++]).then(next).catch(reject); + } catch (err) { reject(err); break; } } }); } @@ -563,7 +567,7 @@ async function run(options) { filterValues: 'Ready,Published', caseType: 'snake', - parallelPages: 3, + parallelPages: 25, parallelDownloadsPerPage: 3, downloadImageTimeout: 30, skipDownloadedImages: true, @@ -614,7 +618,7 @@ dotenv.config(); async function main() { try { - run({ + await run({ notionSecret: process.env.NOTION_SECRET, notionDatabase: process.env.NOTION_DATABASE, filterProp: process.env.FILTER_PROP, diff --git a/package-lock.json b/package-lock.json index f8ef1de2..3edeb006 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "notion-jam", - "version": "0.0.8", + "version": "0.0.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "notion-jam", - "version": "0.0.8", + "version": "0.0.9", "license": "UNLICENSED", "dependencies": { "@actions/core": "^1.8.2", diff --git a/package.json b/package.json index 3f0cf40d..0b04bd93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "notion-jam", "nameFull": "NotionJAM", - "version": "0.0.8", + "version": "0.0.9", "description": "A notion-jam cli / action", "license": "UNLICENSED", "engines": {