Skip to content

feat: add in a timeout option #253

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akhilnarang
Copy link

Resolves #252

pdfkit/pdfkit.py Outdated
Comment on lines 191 to 197
kwargs = {"input": input}

# Check if a timeout was specified and pass it along if so
if self.timeout:
kwargs["timeout"] = self.timeout

stdout, stderr = result.communicate(**kwargs)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kwargs = {"input": input}
# Check if a timeout was specified and pass it along if so
if self.timeout:
kwargs["timeout"] = self.timeout
stdout, stderr = result.communicate(**kwargs)
stdout, stderr = result.communicate(input=input, timeout=timeout)

This should work too?

Copy link
Author

@akhilnarang akhilnarang Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep works, can't remember exactly why I had wanted to avoid passing a None value.
However the default value for timeout is None, so definitely makes sense to just do this.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request - support specifying timeout for pdf generation
2 participants