refactor: pulled out some imports to clean up the MCP render module a bit
This commit is contained in:
+3
-3
@@ -13,6 +13,7 @@ use std::io::{ErrorKind, Read, Write};
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::fs::OpenOptionsExt;
|
use std::os::unix::fs::OpenOptionsExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
@@ -186,12 +187,11 @@ pub fn render_blob_at(
|
|||||||
// file at the final path is always complete and the dedup check below is
|
// file at the final path is always complete and the dedup check below is
|
||||||
// race-safe across processes (same sha means same content).
|
// race-safe across processes (same sha means same content).
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
static TEMP_COUNTER: std::sync::atomic::AtomicUsize =
|
static TEMP_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||||
std::sync::atomic::AtomicUsize::new(0);
|
|
||||||
let temp = dir.join(format!(
|
let temp = dir.join(format!(
|
||||||
"{sha256}.tmp-{}-{}",
|
"{sha256}.tmp-{}-{}",
|
||||||
std::process::id(),
|
std::process::id(),
|
||||||
TEMP_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
|
TEMP_COUNTER.fetch_add(1, Ordering::Relaxed)
|
||||||
));
|
));
|
||||||
let mut options = OpenOptions::new();
|
let mut options = OpenOptions::new();
|
||||||
options.write(true).create_new(true);
|
options.write(true).create_new(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user