This commit is contained in:
2023-11-28 18:17:11 +01:00
parent b43aa68130
commit 8366a1d82e
8 changed files with 50 additions and 408 deletions

View File

@@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration};
use async_trait::async_trait;
use async_mutex::Mutex;
use headless_chrome::{Browser, LaunchOptions};
use tracing::{error, info, debug, trace, warn};
use tracing::{error, info, debug, trace, warn, trace_span};
use rocket::{fairing::{Fairing, self}, Rocket, Build, Request, request::{FromRequest, Outcome}, futures::pin_mut, http::Status};
use tokio::time::sleep;
@@ -55,10 +55,12 @@ impl ChromiumCoordinator {
}
fn create_browser_instance() -> BrowserHolder {
BrowserHolder { browser: Browser::new(LaunchOptions {
idle_browser_timeout: Duration::MAX, // Wait inifinity for commands
..LaunchOptions::default()
}).unwrap() }
trace_span!("Creating Chromium instance").in_scope(|| {
BrowserHolder { browser: Browser::new(LaunchOptions {
idle_browser_timeout: Duration::MAX, // Wait inifinity for commands
..LaunchOptions::default()
}).unwrap() }
})
}
fn spawn_browser(&self) {