refactor: formatting

refactor/sveltekit
Tomáš Mládek 2024-01-14 15:51:39 +01:00
parent c0a705bb33
commit d23d02413e
2 changed files with 29 additions and 6 deletions

View File

@ -970,7 +970,8 @@ impl ResponseError for ExternalFetchError {
}
const MAX_EXTERNAL_SIZE: usize = 128_000_000;
#[tracing::instrument(skip(url), fields(url=%url))]
#[tracing::instrument(skip(url), fields(url = % url))]
fn fetch_external(url: Url) -> Result<(bytes::Bytes, Option<String>), ExternalFetchError> {
debug!("Fetching...");

View File

@ -56,7 +56,7 @@ impl FsStore {
// while diesel doesn't support multiple embedded migrations...
let connection = manager.connect()?;
connection.execute(
r#"
r#"
CREATE TABLE IF NOT EXISTS files
(
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
@ -72,7 +72,7 @@ impl FsStore {
PRAGMA journal_mode = WAL; PRAGMA wal_autocheckpoint = 1000; PRAGMA wal_checkpoint(TRUNCATE);
"#,
)?;
)?;
let pool = r2d2::Pool::builder()
.connection_customizer(Box::new(ConnectionOptions {
@ -323,7 +323,7 @@ impl FsStore {
} else {
trace!("Re-added: {:?}", path);
Ok(UpdatePathOutcome::Added(path.clone()))
}
};
}
}
}
@ -941,7 +941,18 @@ mod test {
.filter(|upo| matches!(upo, UpdatePathOutcome::Removed(_)))
.count()
);
assert!(store.retrieve_all_files().unwrap().iter().filter(|f| f.path == "hello-world.txt").all(|f| !f.valid));
assert!(store
.retrieve_all_files()
.unwrap()
.iter()
.filter(|f| f.path == "hello-world.txt")
.all(|f| !f.valid));
assert!(store
.retrieve_all_files()
.unwrap()
.iter()
.filter(|f| f.path == "hello-world.txt")
.all(|f| !f.valid));
// Re-add the file
let file_path = temp_dir_path.join("hello-world.txt");
@ -982,7 +993,18 @@ mod test {
.filter(|upo| matches!(upo, UpdatePathOutcome::Added(_)))
.count()
);
assert!(store.retrieve_all_files().unwrap().iter().filter(|f| f.path == "hello-world.txt").all(|f| f.valid));
assert!(store
.retrieve_all_files()
.unwrap()
.iter()
.filter(|f| f.path == "hello-world.txt")
.all(|f| f.valid));
assert!(store
.retrieve_all_files()
.unwrap()
.iter()
.filter(|f| f.path == "hello-world.txt")
.all(|f| f.valid));
}
/// Prepare a temporary filesystem structure for testing