let's do it like this instead

This commit is contained in:
Lily Tsuru 2024-09-30 07:10:30 -04:00
parent 068ef70e7e
commit 994863aed8
2 changed files with 12 additions and 10 deletions

View file

@ -92,7 +92,7 @@ async fn main() -> anyhow::Result<()> {
&node_clone.url,
&node_clone.origin,
&id_clone,
date_path.clone().join(&id_clone),
date_path.clone(),
config.webp_quality,
)
.instrument(span)

View file

@ -84,6 +84,8 @@ pub async fn take_one_screenshot(
.in_current_span(),
);
let node_name_clone = node_name.clone();
// main handler
let write_guac_handler_clone = write_tx.clone();
let guac_handler: JoinHandle<anyhow::Result<()>> = tokio::spawn(
@ -114,13 +116,13 @@ pub async fn take_one_screenshot(
let zone = tzfile::Tz::named("GMT")?;
let now = { chrono::Utc::now().with_timezone(&&zone) };
let file_path = root_path.join(format!(
"{:02}-{:02}-{:02}.webp",
now.hour(),
now.minute(),
now.second()
));
let file_path =
root_path.join(&node_name_clone).join(format!(
"{:02}-{:02}-{:02}.webp",
now.hour(),
now.minute(),
now.second()
));
let file_path_clone = file_path.clone();
@ -149,8 +151,8 @@ pub async fn take_one_screenshot(
let encoder = webp::Encoder::from_image(&image)
.expect("fuck you");
if !file_path_clone.exists() {
std::fs::create_dir_all(&file_path_clone)?;
if !root_path.exists() {
std::fs::create_dir_all(&root_path)?;
}
let mut file =