Pick up vault history id and refactor aborting

This commit is contained in:
Andras Schmelczer 2026-09-22 21:49:24 +01:00
commit e0e38597c3
2 changed files with 339 additions and 410 deletions

View file

@ -17,7 +17,9 @@ pub const DEFAULT_MAX_CLIENTS_PER_VAULT: usize = 256;
pub const DEFAULT_LOG_DIRECTORY: &str = "logs";
pub const DEFAULT_LOG_ROTATION_INTERVAL: Duration = Duration::from_secs(60 * 60 * 24); // 1 day
pub const DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Info;
pub const WEBSOCKET_SEND_TIMEOUT: Duration = Duration::from_secs(10);
pub const WEBSOCKET_HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(5);
pub const DEFAULT_MERGEABLE_FILE_EXTENSIONS: &[&str] = &["md", "txt"];

View file

@ -8,7 +8,7 @@ use crate::{
utils::{get_authenticated_handshake, send_update_over_websocket},
},
},
consts::WEBSOCKET_SEND_TIMEOUT,
consts::WEBSOCKET_HANDSHAKE_TIMEOUT,
errors::{SyncServerError, client_error, server_error},
};
use axum::{
@ -59,7 +59,7 @@ async fn websocket(
let authenticated = get_authenticated_handshake(
&state,
&vault,
tokio::time::timeout(WEBSOCKET_SEND_TIMEOUT, receiver.next())
tokio::time::timeout(WEBSOCKET_HANDSHAKE_TIMEOUT, receiver.next())
.await
.map_err(|_| client_error(anyhow::anyhow!("WebSocket handshake deadline expired")))?
.transpose()