mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 18:14:49 +00:00
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:
@@ -785,6 +785,7 @@ async fn remove_existing_imported_pack_content(
|
||||
metadata: &crate::state::InstanceMetadata,
|
||||
state: &State,
|
||||
) -> crate::Result<()> {
|
||||
let _content_lock = state.lock_instance_content(instance_id).await;
|
||||
let entries = content_rows::get_content_entries(
|
||||
&metadata.applied_content_set.id,
|
||||
&state.pool,
|
||||
@@ -821,18 +822,20 @@ async fn remove_existing_imported_pack_content(
|
||||
continue;
|
||||
};
|
||||
crate::util::io::remove_file(base.join(&file.relative_path)).await?;
|
||||
let mut tx = state.pool.begin().await?;
|
||||
content_rows::remove_content_entries_for_file(
|
||||
&metadata.applied_content_set.id,
|
||||
&file.id,
|
||||
&state.pool,
|
||||
&mut tx,
|
||||
)
|
||||
.await?;
|
||||
content_rows::remove_instance_file_by_relative_path(
|
||||
instance_id,
|
||||
&file.relative_path,
|
||||
&state.pool,
|
||||
&mut tx,
|
||||
)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user