From d1bc1c611f4fafd914e1cbae4dfbd1b6fae047d9 Mon Sep 17 00:00:00 2001 From: Hollow Man Date: Tue, 25 Jan 2022 10:30:22 +0800 Subject: [PATCH] Avoid using forever timeouts Signed-off-by: Hollow Man --- Cargo.toml | 2 +- README.md | 2 +- README_CN.md | 2 +- src/main.rs | 2 +- test_doc/book.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0966546..bb0ce9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ readme = "README.md" # # Wait for automatic chrome download to be available: https://github.com/atroche/rust-headless-chrome/issues/286 # headless_chrome = { git = "https://github.com/atroche/rust-headless-chrome", branch = "master", features= ["fetch"] } -# A forked version with my patches. +# A forked version to expand some response timeout to 300 seconds. headless_chrome = { git = "https://github.com/HollowMan6/rust-headless-chrome" } mdbook = "0.4.15" serde = "1.0.134" diff --git a/README.md b/README.md index ee9b7f9..e3e0ac7 100644 --- a/README.md +++ b/README.md @@ -52,4 +52,4 @@ Support customize PDF paper orientation, scale of the webpage rendering, paper w Check [book.toml](test_doc/book.toml#L10-L33) for details for the available configurations of `[output.pdf]`. ## Crates.io -This package currently won't be published to [crates.io](https://crates.io) as one of the dependencies applies patches from the [headless chrome GitHub fork](https://github.com/HollowMan6/rust-headless-chrome). +This package currently won't be published to [crates.io](https://crates.io) as one of the dependencies applies patches from the [headless chrome GitHub fork](https://github.com/HollowMan6/rust-headless-chrome), and the patches [won't be merged to upstream](https://github.com/atroche/rust-headless-chrome/issues/287). diff --git a/README_CN.md b/README_CN.md index 4ad37c9..ef12edf 100644 --- a/README_CN.md +++ b/README_CN.md @@ -53,4 +53,4 @@ enable = true 查看 [book.toml](test_doc/book.toml#L10-L33) 以了解 `[output.pdf]` 可用配置的详细信息。 ## Crates.io -由于本软件的依赖使用了来自 [headless chrome GitHub fork](https://github.com/HollowMan6/rust-headless-chrome) 的补丁,因而目前不会在 [crates.io](https://crates.io) 中发布。 +由于本软件的依赖使用了来自 [headless chrome GitHub fork](https://github.com/HollowMan6/rust-headless-chrome) 的补丁,并且[该补丁并不会被合并](https://github.com/atroche/rust-headless-chrome/issues/287),因而目前不会在 [crates.io](https://crates.io) 中发布。 diff --git a/src/main.rs b/src/main.rs index 4c8bec7..0770509 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,7 @@ fn main() -> Result<(), Box> { .headless(true) .sandbox(false) .ignore_certificate_errors(true) - .idle_browser_timeout(Duration::from_secs(u64::max_value())) + .idle_browser_timeout(Duration::from_secs(600)) .path(browser_binary) .args(vec![ OsStr::new("--unlimited-storage"), diff --git a/test_doc/book.toml b/test_doc/book.toml index 48bff94..afd269d 100644 --- a/test_doc/book.toml +++ b/test_doc/book.toml @@ -12,7 +12,7 @@ title = "An Example" # trying-times = 1 ## This backend only support latest Chromium based browsers, not Safari and Firefox currently. ## If needed, please specify the full path. -## If you specify the wrong binary, chances are that this program will never end. +## If you specify the wrong binary, chances are that there will be a timeout error. # browser-binary-path = "" ## Check Chrome Devtools Protocol Docs for the explanation of the following params: ## https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF