Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/ln_verification/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ use crate::{
shared::HomeserverAdminAPI,
};

/// Default timeout for long-polling verification requests
/// Set to 25 seconds to be below common reverse proxy timeouts (30 seconds)
/// This way, you don't have to deal with proxy timeouts like nginx cutting the connection
/// before the application can respond with a timeout message.
const DEFAULT_TIMEOUT_SECS: u64 = 25;

pub async fn router(
config: &EnvConfig,
db: &crate::infrastructure::sql::SqlDb,
Expand Down Expand Up @@ -101,7 +107,7 @@ async fn await_verification_handler(
) -> impl IntoResponse {
let response = match state
.ln_service
.get_and_await_verification(&id, Duration::from_secs(60))
.get_and_await_verification(&id, Duration::from_secs(DEFAULT_TIMEOUT_SECS))
.await
{
Ok(Some(response)) => response,
Expand Down
Loading