فهرست منبع

desktop: only show loading window if sqlite migration is necessary

Brendan Allan 2 ماه پیش
والد
کامیت
adb0c4d4f9
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      packages/desktop/src-tauri/src/lib.rs

+ 3 - 3
packages/desktop/src-tauri/src/lib.rs

@@ -566,8 +566,8 @@ async fn initialize(app: AppHandle) {
     // come from any invocation of the sidecar CLI. The progress is captured by a stdout stream interceptor.
     // come from any invocation of the sidecar CLI. The progress is captured by a stdout stream interceptor.
     // Then in the loading task, we wait for sqlite migration to complete before
     // Then in the loading task, we wait for sqlite migration to complete before
     // starting our health check against the server, otherwise long migrations could result in a timeout.
     // starting our health check against the server, otherwise long migrations could result in a timeout.
-    let sqlite_enabled = option_env!("OPENCODE_SQLITE").is_some();
-    let sqlite_done = (sqlite_enabled && !sqlite_file_exists()).then(|| {
+    let needs_sqlite_migration = option_env!("OPENCODE_SQLITE").is_some() && !sqlite_file_exists();
+    let sqlite_done = needs_sqlite_migration.then(|| {
         tracing::info!(
         tracing::info!(
             path = %opencode_db_path().expect("failed to get db path").display(),
             path = %opencode_db_path().expect("failed to get db path").display(),
             "Sqlite file not found, waiting for it to be generated"
             "Sqlite file not found, waiting for it to be generated"
@@ -670,7 +670,7 @@ async fn initialize(app: AppHandle) {
     .map_err(|_| ())
     .map_err(|_| ())
     .shared();
     .shared();
 
 
-    let loading_window = if sqlite_enabled
+    let loading_window = if needs_sqlite_migration
         && timeout(Duration::from_secs(1), loading_task.clone())
         && timeout(Duration::from_secs(1), loading_task.clone())
             .await
             .await
             .is_err()
             .is_err()