Skip to content

Commit

Permalink
Remove sleep on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed May 15, 2024
1 parent ab1b91e commit bf6f5d6
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use iced::{
};
use log::{error, warn};
use tokio::sync::RwLock;
use tokio::task::spawn_blocking;

use crate::fedimint_client::{
spawn_onchain_payment_subscription, spawn_onchain_receive_subscription,
Expand Down Expand Up @@ -225,16 +226,12 @@ pub fn run_core() -> Subscription<Message> {
.await
.expect("should send");

// TODO: for some reason the unlocking message gets delivered at the end if I don't sleep here
sleep(Duration::from_secs(1)).await;

// attempting to unlock
let db = setup_db(
path.join("harbor.sqlite")
.to_str()
.expect("path must be correct"),
password,
);
let db_path = path.join("harbor.sqlite");
let join =
spawn_blocking(move || setup_db(db_path.to_str().unwrap(), password));

let db = join.await.expect("Could not create join handle");

if let Err(e) = db {
// probably invalid password
Expand Down

0 comments on commit bf6f5d6

Please sign in to comment.