This commit is contained in:
ranfdev
2024-11-20 20:41:46 +01:00
parent 812e335c41
commit 9c7f701557
10 changed files with 146 additions and 115 deletions

View File

@ -16,11 +16,9 @@ use crate::{
ListenerActor, ListenerCommand, ListenerConfig, ListenerHandle, SharedEnv, SubscriptionHandle,
};
const CONNECT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(15);
const TIMEOUT: std::time::Duration = std::time::Duration::from_secs(240); // 4 minutes
pub fn build_client() -> anyhow::Result<reqwest::Client> {
Ok(reqwest::Client::builder()
.connect_timeout(CONNECT_TIMEOUT)
@ -208,7 +206,11 @@ impl NtfyActor {
password,
respond_to,
} => {
let result = self.env.credentials.insert(&server, &username, &password).await;
let result = self
.env
.credentials
.insert(&server, &username, &password)
.await;
let _ = respond_to.send(result);
}
@ -341,7 +343,12 @@ impl NtfyHandle {
rx.await.map_err(|_| anyhow!("Actor response error"))?
}
pub async fn add_account(&self, server: &str, username: &str, password: &str) -> anyhow::Result<()> {
pub async fn add_account(
&self,
server: &str,
username: &str,
password: &str,
) -> anyhow::Result<()> {
let (tx, rx) = oneshot::channel();
self.command_tx
.send(NtfyMessage::AddAccount {