fix: app restarting after the user closes when there's a pending update (#6074)
* fix: app restarting after the user closes when there's a pending update * add logging and fix tauri variable * use state * use atomicbool
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//! Theseus state management system
|
||||
use crate::util::fetch::{FetchSemaphore, IoSemaphore};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use tokio::sync::{OnceCell, Semaphore};
|
||||
|
||||
use crate::state::fs_watcher::FileWatcher;
|
||||
@@ -83,6 +84,8 @@ pub struct State {
|
||||
/// Friends socket
|
||||
pub friends_socket: FriendsSocket,
|
||||
|
||||
pub restart_after_pending_update: AtomicBool,
|
||||
|
||||
pub(crate) pool: SqlitePool,
|
||||
|
||||
pub(crate) file_watcher: FileWatcher,
|
||||
@@ -146,6 +149,10 @@ impl State {
|
||||
LAUNCHER_STATE.initialized()
|
||||
}
|
||||
|
||||
pub fn get_if_initialized() -> Option<Arc<Self>> {
|
||||
LAUNCHER_STATE.get().map(Arc::clone)
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
async fn initialize_state(
|
||||
app_identifier: String,
|
||||
@@ -194,6 +201,7 @@ impl State {
|
||||
discord_rpc,
|
||||
process_manager,
|
||||
friends_socket,
|
||||
restart_after_pending_update: AtomicBool::new(false),
|
||||
pool,
|
||||
file_watcher,
|
||||
// app_identifier,
|
||||
|
||||
Reference in New Issue
Block a user