fix: various content_row fixes (#6823)

* fix: preserve instance file identity during upsert

* fix: preserve present files when hashing fails

* fix: serialize per-instance content mutations

* fix: prevent duplicate content entries

* fix: make file and content entry writes atomic

* fix: invalidate cached hashes for modified files

* feat: content lock

* fix: boris rev
This commit is contained in:
Calum H.
2026-07-23 20:36:21 +00:00
committed by GitHub
parent 95f97a44ec
commit 5c697f675c
21 changed files with 915 additions and 292 deletions
@@ -798,6 +798,16 @@ pub(crate) async fn install_zipped_mrpack_files_with_reporter(
let downloaded_bytes = file.len() as u64;
let path = target_path;
content_context
.reporter
.preserve_failure_context(
context.clone(),
write(&path, &file, &state.io_semaphore).await,
)
.await?;
let modified_at_ns = crate::state::file_modified_at_ns(
&io::metadata(&path).await?,
)?;
{
let _permit = state.install_db_semaphore.acquire().await?;
@@ -809,6 +819,7 @@ pub(crate) async fn install_zipped_mrpack_files_with_reporter(
file.clone(),
&content_context.instance_path,
project.path.as_str(),
modified_at_ns,
project
.hashes
.get(&PackFileHash::Sha1)
@@ -822,14 +833,6 @@ pub(crate) async fn install_zipped_mrpack_files_with_reporter(
.await?;
}
content_context
.reporter
.preserve_failure_context(
context.clone(),
write(&path, &file, &state.io_semaphore).await,
)
.await?;
if let Some(project_type) =
ProjectType::get_from_parent_folder(project.path.as_str())
{
@@ -998,6 +1001,8 @@ pub(crate) async fn install_zipped_mrpack_files_with_reporter(
let (size, hash) = reporter
.preserve_failure_context(override_context, extract_result)
.await?;
let modified_at_ns =
crate::state::file_modified_at_ns(&io::metadata(&path).await?)?;
{
let _permit = state.install_db_semaphore.acquire().await?;
@@ -1016,6 +1021,7 @@ pub(crate) async fn install_zipped_mrpack_files_with_reporter(
&instance_path,
relative_override_file_path.as_str(),
size,
modified_at_ns,
hash.clone(),
ProjectType::get_from_parent_folder(
relative_override_file_path.as_str(),