DEFAULT_TIMEOUT_SECS

Constant DEFAULT_TIMEOUT_SECS 

Source
pub const DEFAULT_TIMEOUT_SECS: u64 = 60;
Expand description

Default timeout for the entire PDF generation operation in seconds.

This timeout encompasses the complete operation including:

  • Browser acquisition from pool
  • Page navigation
  • JavaScript execution wait
  • PDF rendering
  • Tab cleanup

If the operation exceeds this duration, a PdfServiceError::Timeout error is returned.

§Default Value

60 seconds - sufficient for most web pages, including those with heavy JavaScript and external resources.

§Customization

This constant is used by framework integrations for their timeout wrappers. To customize, create your own timeout wrapper around the service functions.

use std::time::Duration;
use tokio::time::timeout;

let custom_timeout = Duration::from_secs(120); // 2 minutes

let result = timeout(custom_timeout, async {
    tokio::task::spawn_blocking(move || {
        generate_pdf_from_url(&pool, &request)
    }).await
}).await;