-
Notifications
You must be signed in to change notification settings - Fork 0
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
How do I add setTimeout() ? #1
Comments
Hi, the timeout is enforced by the API layer, not the client, so I'm not sure setting it locally will have any effect. There is generally a timeout of about 90 seconds on the SaaS platform, and so if you have many PDFs, the service has to:
If that exceeds the timeout, it will error out in that way. There is a strategy you can consider employing to mitigate this issue: Let's say you have 100 pdfs to merge together into a single PDF. Instead of 1 api call with 100 pdfs, do 10 api calls with 10 pdfs each. Now you have 10 pdfs back from the service as a result. Then do 1 more call to combine these 10 pdfs you got back into 1 pdf. We call this "stacking the merge". You can stack the merge in different buckets of PDFs to see the optimal stacking strategy. If that does not work, we do offer a managed hosting service which lifts basically all memory and timeout limits, but typically only enterprise customers go for this as the costs are higher, you can reach out to support@api2pdf.com for details. |
Thank you @apexdodge ! Before I saw your message I edited one of the classes included in this package and added the timeout value. It seems to work! I was able to process 25 merged PDFs without issue. If I run into issues with larger groups of documents in the future I will look into merge stacking as you suggest. |
Thanks for this tool. It works well except for when I try to pass a largelist of pdfs for merging. I get a timed out error because, I assume, it's taking some time for api2pdf to merge the PDFs and send back a response. I've read that I can add a setTimeout() value, something like
a2pclient.setTimeout(120000);
Can you give me some direction as to how I can update the sample code you've given for merging that will allow for longer time out?
The text was updated successfully, but these errors were encountered: