(&self)
| 967 | } |
| 968 | |
| 969 | fn stats(&self) -> Result<(), Error> { |
| 970 | if !self.is_avoid_stats() && !self.is_offline() { |
| 971 | let props = Props { |
| 972 | browser: self.get_browser_name().to_ascii_lowercase(), |
| 973 | browser_version: self.get_browser_version().to_ascii_lowercase(), |
| 974 | os: self.get_os().to_ascii_lowercase(), |
| 975 | arch: self |
| 976 | .get_normalized_arch() |
| 977 | .unwrap_or(ARCH_OTHER) |
| 978 | .to_ascii_lowercase(), |
| 979 | lang: self.get_language_binding().to_ascii_lowercase(), |
| 980 | selenium_version: self.get_selenium_version().to_ascii_lowercase(), |
| 981 | }; |
| 982 | let http_client = self.get_http_client().to_owned(); |
| 983 | let sender = self.get_sender().to_owned(); |
| 984 | let cache_path = self.get_cache_path()?; |
| 985 | let mut metadata = get_metadata(self.get_logger(), &cache_path); |
| 986 | if !is_stats_in_metadata(&metadata.stats, &props) { |
| 987 | self.get_logger() |
| 988 | .debug(format!("Sending stats to Plausible: {:?}", props,)); |
| 989 | let stats_ttl = self.get_ttl(); |
| 990 | if stats_ttl > 0 { |
| 991 | metadata |
| 992 | .stats |
| 993 | .push(create_stats_metadata(&props, stats_ttl)); |
| 994 | write_metadata(&metadata, self.get_logger(), cache_path); |
| 995 | } |
| 996 | thread::spawn(move || { |
| 997 | send_stats_to_plausible(http_client, props, sender); |
| 998 | }); |
| 999 | } |
| 1000 | } |
| 1001 | Ok(()) |
| 1002 | } |
| 1003 | |
| 1004 | fn check_error_with_driver_in_path( |
| 1005 | &mut self, |
no test coverage detected