It seems that sometimes printToPDF does not complete and hangs forever (see https://github.com/electron/electron/issues/20634). This is problematic because the window stays open forever. If you get this problem often, there will eventually be too many windows opened and you will get an out of memory error.
This PR introduces a change that will automatically close the window if a timeout was provided and if printToPDF takes longer than it. The rationale is that printing to PDF should not take longer than the initial page load so we can rely on the user's provided timeout.
A more elegant approach would be to perform cleanup at the component level whenever the HTTP server drops a client request because it's taking too long. At the moment, we keep working even if the connection is dropped...
It seems that sometimes
printToPDF
does not complete and hangs forever (see https://github.com/electron/electron/issues/20634). This is problematic because the window stays open forever. If you get this problem often, there will eventually be too many windows opened and you will get an out of memory error.This PR introduces a change that will automatically close the window if a timeout was provided and if
printToPDF
takes longer than it. The rationale is that printing to PDF should not take longer than the initial page load so we can rely on the user's provided timeout.A more elegant approach would be to perform cleanup at the component level whenever the HTTP server drops a client request because it's taking too long. At the moment, we keep working even if the connection is dropped...
cc @alexcjohnson @josegonzalez