Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions packages/app-lib/src/api/instance/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub async fn set_group_memberships(
let updates = normalize_membership_updates(updates)?;

let state = State::get().await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let unique_group_ids = updates
.iter()
.flat_map(|update| update.group_ids.iter())
Expand Down Expand Up @@ -173,7 +173,7 @@ pub async fn rename_group(

let new_name = validate_group_name(&new_name)?;
let state = State::get().await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;

let instance_ids = sqlx::query_scalar!(
"
Expand Down Expand Up @@ -224,7 +224,7 @@ pub async fn delete_group(id: String) -> crate::Result<()> {
}

let state = State::get().await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let instance_ids = sqlx::query_scalar!(
"
SELECT instance_id
Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/src/api/instance/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub async fn cache_generated_icon(
.await?;

if add_to_recents {
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
instance_rows::update_recent_instance_icon_config(&config, &mut tx)
.await?;
tx.commit().await?;
Expand Down
6 changes: 3 additions & 3 deletions packages/app-lib/src/api/instance/screenshot_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub async fn create_screenshot_group(
let name = validate_group_name(&name)?;
let state = State::get().await?;
let id = Uuid::new_v4().to_string();
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;

sqlx::query!(
"UPDATE screenshot_groups SET display_order = display_order + 1",
Expand Down Expand Up @@ -156,7 +156,7 @@ pub async fn set_screenshot_group_memberships(
}

let state = State::get().await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let group_ids = updates
.iter()
.filter_map(|update| update.group_id.as_deref())
Expand Down Expand Up @@ -199,7 +199,7 @@ pub async fn import_screenshot_groups(
}

let state = State::get().await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let base_order = sqlx::query_scalar!(
"SELECT COALESCE(MAX(display_order) + 1, 0) AS 'display_order!: i64' FROM screenshot_groups",
)
Expand Down
6 changes: 3 additions & 3 deletions packages/app-lib/src/api/instance/screenshots/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ pub async fn save_edited_screenshot(
let mut source_row = source_row.clone();
source_row.content_hash = content_hash;
source_row.file_size = file_size;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
screenshot_rows::update_screenshot(&source_row, &mut tx).await?;
tx.commit().await?;
}
Expand All @@ -448,7 +448,7 @@ pub async fn save_edited_screenshot(

if copy_group {
let result: crate::Result<()> = async {
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
screenshot_rows::copy_group_membership(
&source_row.id,
&saved.id,
Expand Down Expand Up @@ -483,7 +483,7 @@ pub async fn save_edited_screenshot(
)
})?;
if !copy_group {
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
if saved_row.created_at != source_row.created_at {
saved_row.created_at = source_row.created_at;
screenshot_rows::update_screenshot(&saved_row, &mut tx).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub(super) async fn reconcile_source_screenshots(
));
}

let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
for row in unmatched_by_hash.into_values().flatten() {
screenshot_rows::delete_screenshot(&row.id, &mut tx).await?;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub(crate) async fn update_shared_fullscreen_from_app(
let raw_key: Option<&str> = None;
let value_codec = "catalog";
let source_game_version: Option<&str> = None;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;

sqlx::query!(
"\n\t\t\t\tINSERT INTO synced_game_option_values\n\t\t\t\t\t(option_id, kind, raw_key, canonical_type,\n\t\t\t\t\t canonical_value_json, value_codec, seeded, revision, origin,\n\t\t\t\t\t source_game_version, source_instance_id, updated_at)\n\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, 1, ?, 'app_editor', ?, NULL, ?)\n\t\t\t\tON CONFLICT(option_id) DO UPDATE SET\n\t\t\t\t\tkind = excluded.kind, raw_key = excluded.raw_key,\n\t\t\t\t\tcanonical_type = excluded.canonical_type,\n\t\t\t\t\tcanonical_value_json = excluded.canonical_value_json,\n\t\t\t\t\tvalue_codec = excluded.value_codec, seeded = 1,\n\t\t\t\t\trevision = excluded.revision, origin = 'app_editor',\n\t\t\t\t\tsource_game_version = NULL, source_instance_id = NULL,\n\t\t\t\t\tupdated_at = excluded.updated_at\n\t\t\t\t",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ async fn index_installed_sources(state: &State) -> crate::Result<()> {
resolver
.index_snapshot(state, &snapshot_id, snapshot.clone())
.await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
for (id, key) in &keys {
let observation = Observation {
snapshot: snapshot_id.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub(super) async fn read_instance_changes_into_shared_settings(
if !updates.is_empty() {
let (canonical_revision, _) =
load_game_options_sync_state(&state.pool, CATALOG_REVISION).await?;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
for (option_id, candidate, revision) in updates {
let next_revision = revision.saturating_add(1) as i64;
let current_revision = revision as i64;
Expand Down Expand Up @@ -193,7 +193,7 @@ pub(super) async fn discover_custom_settings(
} else {
None
};
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let game_version = metadata.applied_content_set.game_version.as_str();

for definition in all_supported_settings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ pub async fn save_changes(

let mut changed = false;
let mut fullscreen_value = None;
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
for (setting, change) in accepted {
let resulting_enabled =
change.sync_enabled.unwrap_or(setting.sync_enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub(in crate::api::instance) async fn initialize_from_source_instance(
} else {
None
};
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let catalog_revision = CATALOG_REVISION as i64;

sqlx::query!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn replace_modpack_servers(
server.position = local.len() as i64;
local.push(server.clone());
}
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
write_local_rows(&mut tx, &metadata.instance.id, &local).await?;
let version_id = modpack_version_id(&metadata.link);
sqlx::query!(
Expand Down
4 changes: 2 additions & 2 deletions packages/app-lib/src/api/instance/synced_servers/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub(super) async fn commit_server_state(
local: Option<(&str, &[LocalServer])>,
state: &State,
) -> crate::Result<bool> {
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
let mut canonical_changed = false;
if let Some(canonical) = canonical {
canonical_changed = write_canonical_rows(&mut tx, canonical).await?;
Expand Down Expand Up @@ -320,7 +320,7 @@ pub(super) async fn begin_server_checkpoint(
source_revision: i64,
state: &State,
) -> crate::Result<()> {
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
sqlx::query!(
"DELETE FROM instance_server_projection_entries WHERE instance_id = ?",
instance_id,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/src/install/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async fn restore_instance_metadata(
state: &State,
) -> crate::Result<()> {
let content_set_id = metadata.applied_content_set.id.as_str();
let mut tx = state.pool.begin().await?;
let mut tx = state.pool.begin_with("BEGIN IMMEDIATE").await?;
instance_rows::update_instance(&metadata.instance, &mut tx).await?;
content_rows::update_content_set(&metadata.applied_content_set, &mut tx)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/src/install/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ pub async fn complete_success(
let now = Utc::now().timestamp();
let json = serde_json::to_string(state)?;
let id_value = id.to_string();
let mut transaction = app_state.pool.begin().await?;
let mut transaction = app_state.pool.begin_with("BEGIN IMMEDIATE").await?;

let job_result = sqlx::query(
"
Expand Down
6 changes: 3 additions & 3 deletions packages/app-lib/src/state/content_store/commands/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl ContentStore {
stored_files: &[String],
) -> crate::Result<()> {
let _lease = self.lease().await;
let mut tx = self.pool.begin().await?;
let mut tx = self.pool.begin_with("BEGIN IMMEDIATE").await?;
for stored_file in stored_files {
catalog::retain(&mut tx, kind, owner, stored_file).await?;
}
Expand All @@ -29,7 +29,7 @@ impl ContentStore {
stored_files: &[String],
) -> crate::Result<()> {
let _lease = self.lease().await;
let mut tx = self.pool.begin().await?;
let mut tx = self.pool.begin_with("BEGIN IMMEDIATE").await?;
catalog::release(&mut tx, kind, owner).await?;
for stored_file in stored_files {
catalog::retain(&mut tx, kind, owner, stored_file).await?;
Expand All @@ -43,7 +43,7 @@ impl ContentStore {
kind: &str,
owner: &str,
) -> crate::Result<()> {
let mut tx = self.pool.begin().await?;
let mut tx = self.pool.begin_with("BEGIN IMMEDIATE").await?;
catalog::release(&mut tx, kind, owner).await?;
tx.commit().await?;
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl ContentStore {
&self,
journal: &FileChangeJournal,
) -> crate::Result<()> {
let mut tx = self.pool.begin().await?;
let mut tx = self.pool.begin_with("BEGIN IMMEDIATE").await?;
for file_status in
[&journal.before, &journal.after].into_iter().flatten()
{
Expand Down
Loading
Loading