(&self)
| 989 | } |
| 990 | |
| 991 | fn stats(&self) -> Result<(), Error> { |
| 992 | if !self.is_avoid_stats() && !self.is_offline() { |
| 993 | let props = Props { |
| 994 | browser: self.get_browser_name().to_ascii_lowercase(), |
| 995 | browser_version: self.get_browser_version().to_ascii_lowercase(), |
| 996 | os: self.get_os().to_ascii_lowercase(), |
| 997 | arch: self |
| 998 | .get_normalized_arch() |
| 999 | .unwrap_or(ARCH_OTHER) |
| 1000 | .to_ascii_lowercase(), |
| 1001 | lang: self.get_language_binding().to_ascii_lowercase(), |
| 1002 | selenium_version: self.get_selenium_version().to_ascii_lowercase(), |
| 1003 | }; |
| 1004 | let http_client = self.get_http_client().to_owned(); |
| 1005 | let sender = self.get_sender().to_owned(); |
| 1006 | let cache_path = self.get_cache_path()?; |
| 1007 | let mut metadata = get_metadata(self.get_logger(), &cache_path); |
| 1008 | if !is_stats_in_metadata(&metadata.stats, &props) { |
| 1009 | self.get_logger() |
| 1010 | .debug(format!("Sending stats to Plausible: {:?}", props,)); |
| 1011 | let stats_ttl = self.get_ttl(); |
| 1012 | if stats_ttl > 0 { |
| 1013 | metadata |
| 1014 | .stats |
| 1015 | .push(create_stats_metadata(&props, stats_ttl)); |
| 1016 | write_metadata(&metadata, self.get_logger(), cache_path); |
| 1017 | } |
| 1018 | thread::spawn(move || { |
| 1019 | send_stats_to_plausible(http_client, props, sender); |
| 1020 | }); |
| 1021 | } |
| 1022 | } |
| 1023 | Ok(()) |
| 1024 | } |
| 1025 | |
| 1026 | fn check_error_with_driver_in_path( |
| 1027 | &mut self, |
no test coverage detected