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

Parallel generation - are multiple .start()'s needed? #52

Open
actuallymentor opened this issue Dec 6, 2019 · 1 comment
Open

Parallel generation - are multiple .start()'s needed? #52

actuallymentor opened this issue Dec 6, 2019 · 1 comment

Comments

@actuallymentor
Copy link

Thanks for this wonderful package!

I'm generating two pdfs in the following approximate manner:

const pdfWithCover = new pdf( {...} )
const pdfWithoutCover = new pdf( {...} )

await pdfWithCover.start()
await pdfWithoutCover.start()

await Promise.all( [
	pdfWithCover.build(),
	pdfWithoutCover.build()
] )

await pdfWithCover.close()
await pdfWithoutCover.close()

Does this introduce overhead by calling two .start()'s or is that inconsequential? Is there a resource-optimal way to do this as scale? (e.g. generating 100 pdfs).

Thank you!

@peterdemartini
Copy link
Owner

peterdemartini commented Jul 25, 2020

Multiple starts are needed for this. But it might make sense to have a reusable puppeteer instance, which will require a change to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants