Skip to content

Commit

Permalink
Remove sleep on startup
Browse files Browse the repository at this point in the history
Co-authored-by: TonyGiorgio <[email protected]>
  • Loading branch information
benthecarman and TonyGiorgio committed May 15, 2024
1 parent ab1b91e commit 85d49eb
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ use std::str::FromStr;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::time::{Duration, SystemTime};
use tokio::time::sleep;

use iced::{
futures::{channel::mpsc::Sender, SinkExt},
subscription::{self, Subscription},
};
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 +225,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 db =
spawn_blocking(move || setup_db(db_path.to_str().unwrap(), password))
.await
.expect("Could not create join handle");

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

0 comments on commit 85d49eb

Please sign in to comment.