fix(lib): give the login verdict the wait the caller already allows
The actor gave the server 5 seconds to answer a login before reporting Timeout, while Client::login documents and allows 45. Under load — 24 e2e tests sharing one soulfind — 5 seconds is not always enough, which is how CI failed on a docs-only commit.
This commit is contained in:
@@ -35,6 +35,11 @@ use std::time::{Duration, Instant};
|
||||
|
||||
use crate::{SoulseekRs, debug, error, trace, warn};
|
||||
|
||||
/// Ceiling on the wait for the server's login verdict. A loaded server can
|
||||
/// take seconds to answer, so this stays inside the caller's own 45s bound
|
||||
/// rather than undercutting it.
|
||||
const LOGIN_VERDICT_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PeerAddress {
|
||||
host: String,
|
||||
@@ -642,12 +647,11 @@ impl ServerActor {
|
||||
));
|
||||
|
||||
let start = std::time::Instant::now();
|
||||
let timeout = Duration::from_secs(5);
|
||||
|
||||
let context = self.context.clone();
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
if start.elapsed() >= timeout {
|
||||
if start.elapsed() >= LOGIN_VERDICT_TIMEOUT {
|
||||
let _ = response.send(Err(SoulseekRs::Timeout));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user