You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fetch method of Fetcher looks for existing chrome installations, otherwise installs one which is cool. But if I am not missing anything, there is no public function that makes the fetch function available for use. The fetch function is called intenally only when Browser::new() is called.
So, suppose we have a REST Rust server and there is an API to generate some report. The API request handler internally uses headless chrome and launches browser for each request. Then the first request will wait until Browser::new installs chrome.
If Fetcher is public, then I don't need to use Browser::new() for the installation. Instead, I can pass env configurations to the server initializer function and install chrome while setting up the server only -
/// A global static launchoptions settingspubstaticCHROME_LAUNCHER_OPTIONS:Lazy<LaunchOptions<'_>> = Lazy::new(|| {letmut options = LaunchOptions::default_builder();
options
.window_size(Some((CONFIG.chrome.chrome_window_width,CONFIG.chrome.chrome_window_height,))).enable_logging(CONFIG.chrome.chrome_enable_logging).idle_browser_timeout(Duration::from_secs(CONFIG.chrome.chrome_idle_timeout.into(),));if !CONFIG.chrome.chrome_path.is_empty(){
options.path(Some(CONFIG.chrome.chrome_path.clone().into()));}letmut options = options.build().unwrap();// Install chrome executable now and not while creating browser instanceif options.path.is_none(){let fetch = Fetcher::new(options.fetcher_options.clone());
options.path = Some(fetch.fetch().unwrap());}
options
});
The text was updated successfully, but these errors were encountered:
The
fetch
method ofFetcher
looks for existing chrome installations, otherwise installs one which is cool. But if I am not missing anything, there is no public function that makes thefetch
function available for use. Thefetch
function is called intenally only whenBrowser::new()
is called.So, suppose we have a REST Rust server and there is an API to generate some report. The API request handler internally uses headless chrome and launches browser for each request. Then the first request will wait until
Browser::new
installs chrome.If
Fetcher
is public, then I don't need to useBrowser::new()
for the installation. Instead, I can pass env configurations to the server initializer function and install chrome while setting up the server only -The text was updated successfully, but these errors were encountered: