refactor: formatting
parent
c0a705bb33
commit
d23d02413e
|
@ -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...");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue