Skip to content

Commit

Permalink
set weasyprint timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
cproof committed Apr 23, 2024
1 parent cb61196 commit 0917cb5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;

@Slf4j
public class WeasyprintPdfConverter implements PdfConverter {
Expand All @@ -23,9 +24,11 @@ public void convertHtml(Path htmlSource, Path pdfTarget) throws IOException {
pdfTarget.toAbsolutePath().toString());
Process weasyProcess = weasyProcessBuilder.start();
try {
weasyProcess.waitFor();
weasyProcess.waitFor(10, TimeUnit.MINUTES);
log.info("PDF generation with weasyprint finished");
} catch (InterruptedException e) {
weasyProcess.destroy();
log.info("PDF generation with weasyprint terminated by timeout");
throw new IOException(e);
}
}
Expand Down

0 comments on commit 0917cb5

Please sign in to comment.