Skip to content

Commit 6d2a11d

Browse files
authored
fix: hung install jobs (#7817)
1 parent 2a01035 commit 6d2a11d

18 files changed

Lines changed: 534 additions & 227 deletions

File tree

‎apps/app-frontend/src/components/ui/Instance.vue‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ const installed = computed(() => props.instance.install_stage === 'installed')
7272
const router = useRouter()
7373
7474
const seeInstance = async () => {
75-
if (installing.value) return
7675
await router.push(`/instance/${encodeURIComponent(props.instance.id)}`)
7776
}
7877

‎apps/app-frontend/src/pages/instance/components/page-header/index.vue‎

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,7 @@
7171
<template #actions>
7272
<PageHeaderActions>
7373
<Button
74-
v-if="isInstalling"
75-
type="colored"
76-
color="brand"
77-
size="xl"
78-
native-type="button"
79-
disabled
80-
>
81-
{{ formatMessage(commonMessages.installingLabel) }}
82-
</Button>
83-
<Button
84-
v-else-if="playing"
74+
v-if="playing"
8575
type="colored"
8676
color="red"
8777
size="xl"
@@ -94,6 +84,16 @@
9484
stopping ? formatMessage(messages.stopping) : formatMessage(commonMessages.stopButton)
9585
}}
9686
</Button>
87+
<Button
88+
v-else-if="isInstalling"
89+
type="colored"
90+
color="brand"
91+
size="xl"
92+
native-type="button"
93+
disabled
94+
>
95+
{{ formatMessage(commonMessages.installingLabel) }}
96+
</Button>
9797
<Button
9898
v-else-if="instance.quarantined"
9999
v-tooltip="formatMessage(messages.lockedPlayTooltip)"
@@ -310,17 +310,12 @@ const emit = defineEmits<{
310310
report: [event?: MouseEvent]
311311
}>()
312312
313-
const installingStages = [
314-
'installing',
315-
'pack_installing',
316-
'pack_installed',
317-
'not_installed',
318-
'minecraft_installing',
319-
]
313+
const installingStages = ['installing', 'pack_installing', 'minecraft_installing']
320314
321315
const { formatMessage } = useVIntl()
322316
323317
const isInstalling = computed(() => installingStages.includes(props.instance.install_stage))
318+
324319
const loaderDisplayName = computed(() => formatLoaderLabel(props.instance.loader) as ServerLoader)
325320
const loaderLabel = computed(() =>
326321
[loaderDisplayName.value, props.instance.game_version].filter(Boolean).join(' '),

‎apps/app/src/main.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ async fn set_restart_after_pending_update(
115115
// if Tauri app is called with arguments, then those arguments will be treated as commands
116116
// ie: deep links or filepaths for .mrpacks
117117
fn main() {
118+
let runtime = tokio::runtime::Builder::new_multi_thread()
119+
.enable_all()
120+
.build()
121+
.expect("failed to create app async runtime");
122+
tauri::async_runtime::set(runtime.handle().clone());
123+
118124
#[cfg(feature = "export-app-events")]
119125
theseus::export_app_event_bindings(
120126
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))

‎packages/app-lib/.sqlx/query-1f778f4aebf65f0ec289bad1448edc640dea4ba9b6974340ee97854efed8bae4.json‎

Lines changed: 0 additions & 68 deletions
This file was deleted.

packages/app-lib/.sqlx/query-c6bdc28338f3668ff2a320368f783293c458336d82332b1618acf8bcf0ad4d79.json renamed to packages/app-lib/.sqlx/query-3426d4a94c809e3a121323994d8346e628a46dba8462c602c86cd326fb7d2ecf.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/app-lib/src/api/instance/lifecycle.rs‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,32 @@ use crate::state::{
66
InstanceMetadata, InstanceSyncedOption, ModLoader, State,
77
};
88

9+
use std::future::Future;
10+
11+
#[allow(clippy::too_many_arguments)]
12+
pub(crate) fn create(
13+
name: String,
14+
game_version: String,
15+
modloader: ModLoader,
16+
loader_version: Option<String>,
17+
icon_path: Option<String>,
18+
icon_config: Option<InstanceIconConfig>,
19+
link: InstanceLink,
20+
) -> impl Future<Output = crate::Result<InstanceMetadata>> + Send + 'static {
21+
Box::pin(create_inner(
22+
name,
23+
game_version,
24+
modloader,
25+
loader_version,
26+
icon_path,
27+
icon_config,
28+
link,
29+
))
30+
}
31+
932
#[tracing::instrument]
1033
#[allow(clippy::too_many_arguments)]
11-
pub(crate) async fn create(
34+
async fn create_inner(
1235
name: String,
1336
game_version: String,
1437
modloader: ModLoader,

‎packages/app-lib/src/api/pack/import/mod.rs‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{
22
fmt,
3+
future::Future,
34
path::{Path, PathBuf},
45
};
56

@@ -122,21 +123,20 @@ pub async fn get_importable_instances(
122123
Ok(instances)
123124
}
124125

125-
pub(crate) async fn import_instance_with_reporter(
126+
pub(crate) fn import_instance_with_reporter(
126127
instance_id: &str,
127128
launcher_type: ImportLauncherType,
128129
base_path: PathBuf,
129130
instance_folder: String,
130131
reporter: InstallProgressReporter,
131-
) -> crate::Result<()> {
132-
import_instance_inner(
132+
) -> impl Future<Output = crate::Result<()>> + Send + '_ {
133+
Box::pin(import_instance_inner(
133134
instance_id,
134135
launcher_type,
135136
base_path,
136137
instance_folder,
137138
reporter,
138-
)
139-
.await
139+
))
140140
}
141141

142142
async fn import_instance_inner(
@@ -365,7 +365,23 @@ pub async fn recache_icon(
365365
}
366366
}
367367

368-
pub(crate) async fn copy_dotminecraft_with_reporter(
368+
pub(crate) fn copy_dotminecraft_with_reporter<'a>(
369+
instance_id: &'a str,
370+
dotminecraft: PathBuf,
371+
io_semaphore: &'a IoSemaphore,
372+
reporter: InstallProgressReporter,
373+
details: InstallPhaseDetails,
374+
) -> impl Future<Output = crate::Result<()>> + Send + 'a {
375+
Box::pin(copy_dotminecraft_with_reporter_inner(
376+
instance_id,
377+
dotminecraft,
378+
io_semaphore,
379+
reporter,
380+
details,
381+
))
382+
}
383+
384+
async fn copy_dotminecraft_with_reporter_inner(
369385
instance_id: &str,
370386
dotminecraft: PathBuf,
371387
io_semaphore: &IoSemaphore,

‎packages/app-lib/src/api/pack/install_mrpack.rs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,21 @@ where
509509
Ok((size, hasher.digest().to_string()))
510510
}
511511

512-
pub(crate) async fn install_zipped_mrpack_files_with_reporter(
512+
pub(crate) fn install_zipped_mrpack_files_with_reporter(
513+
create_pack: CreatePack,
514+
ignore_lock: bool,
515+
reason: DownloadReason,
516+
reporter: InstallProgressReporter,
517+
) -> impl Future<Output = crate::Result<String>> + Send + 'static {
518+
Box::pin(install_zipped_mrpack_files_with_reporter_inner(
519+
create_pack,
520+
ignore_lock,
521+
reason,
522+
reporter,
523+
))
524+
}
525+
526+
async fn install_zipped_mrpack_files_with_reporter_inner(
513527
create_pack: CreatePack,
514528
ignore_lock: bool,
515529
reason: DownloadReason,

‎packages/app-lib/src/install/mod.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Major install stages box their futures at entry so callers do not embed
2+
//! the full stage state. Keep large awaited operations behind these boundaries.
3+
4+
#![deny(clippy::large_futures)]
5+
16
pub(crate) mod control;
27
mod diagnostics;
38
pub mod events;

‎packages/app-lib/src/install/model.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ pub struct SharedInstanceInstallModpack {
259259
pub version_id: String,
260260
pub title: String,
261261
pub icon_url: Option<String>,
262+
#[serde(default)]
262263
pub dependency_count: usize,
263264
}
264265

0 commit comments

Comments
 (0)