-
Notifications
You must be signed in to change notification settings - Fork 137
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
Sometimes PDF generation with exportJob takes too long time #228
Comments
Thanks for the detailed issue. Something doesn't seem to be adding up. You show that you are setting Can you set a breakpoint on const timeout = setTimeout(f, maxWait) and see what the If the page you're loading is not emitting |
logger('maxWait', maxWait)
const timeout = setTimeout(f, maxWait) The
According docs (https://nodejs.org/api/timers.html#timers_settimeout_callback_delay_args):
But 10 seconds delay is too much:
|
Interesting, I have not seen this behavior before. If you can publish your entire project to a repo I can try to reproduce what you're seeing. |
I added some additional logging right before the timer is set and right after the
Unfortunately this appears to be a bug inside Electron (or Chromium) I tried to use the flag mentioned in this comment: Which can be set using the const options = {
...
outputWait: 100,
browserConfig: '{"webPreferences": {"backgroundThrottling": false}}'
} I suspect it doesn't have any effect because the timer is on the main process, and that setting applies to the renderer process. This isn't an issue for my use case because the pages being exported all emit the If you have similar control over the content I recommend this approach. If you are exporting pages (like wikipedia) outside your control you're kind of stuck. I'm sure you can get creative :) |
I run test with local page (https://raw.githubusercontent.com/fraserxu/electron-pdf/master/test/event-test.html) and get same results with delaying rendering from 100 ms up to 10 s. So this approach doesn't work too. |
I am trying to create service for generating PDF built on Express Js and electron-pdf:
Destroying jobs manually, I am able to disable
windowMaid
cleaner:Average time for generation the example PDF is 3 secs, but after several tests I found some strange behavior – every 30 seconds generation hungs on 10 seconds at this place of exportJob.js:_executeJSListener:
After 2-3 sec response time is back to 3 sec. I was trying to inject dispatching event 'view-ready' at local html file instead of wiki test page, but it didn't help.
Some additional information, starting server:
www.js
:The text was updated successfully, but these errors were encountered: