mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-01 20:07:39 +03:00
Add delay for test server availability, could cause connect race (#533)
This commit is contained in:
parent
5621ca1898
commit
3b58f5a111
4 changed files with 21 additions and 8 deletions
|
@ -59,17 +59,19 @@ where
|
|||
.workers(1)
|
||||
.disable_signals()
|
||||
.run();
|
||||
tx.send((system, local_addr, server))
|
||||
.expect("Failed to send Server to TestServer");
|
||||
|
||||
ntex_rt::spawn(async move {
|
||||
ntex_util::time::sleep(ntex_util::time::Millis(75)).await;
|
||||
tx.send((system, local_addr, server))
|
||||
.expect("Failed to send Server to TestServer");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
});
|
||||
|
||||
let (system, addr, server) = rx.recv().unwrap();
|
||||
|
||||
// wait for server
|
||||
thread::sleep(std::time::Duration::from_millis(50));
|
||||
|
||||
TestServer {
|
||||
addr,
|
||||
server,
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Changes
|
||||
|
||||
## [2.12.3] - 2025-03-xx
|
||||
|
||||
* http: Add delay for test server availability, could cause connect race
|
||||
|
||||
## [2.12.2] - 2025-03-15
|
||||
|
||||
* http: Allow to run publish future to completion in case error
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::server::Server;
|
|||
use crate::service::ServiceFactory;
|
||||
#[cfg(feature = "ws")]
|
||||
use crate::ws::{error::WsClientError, WsClient, WsConnection};
|
||||
use crate::{rt::System, time::Millis, time::Seconds, util::Bytes};
|
||||
use crate::{rt::System, time::sleep, time::Millis, time::Seconds, util::Bytes};
|
||||
|
||||
use super::client::{Client, ClientRequest, ClientResponse, Connector};
|
||||
use super::error::{HttpError, PayloadError};
|
||||
|
@ -244,7 +244,11 @@ where
|
|||
.workers(1)
|
||||
.disable_signals()
|
||||
.run();
|
||||
tx.send((system, srv, local_addr)).unwrap();
|
||||
|
||||
crate::rt::spawn(async move {
|
||||
sleep(Millis(75)).await;
|
||||
tx.send((system, srv, local_addr)).unwrap();
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
});
|
||||
|
|
|
@ -697,7 +697,10 @@ where
|
|||
.set_tag("test", "WEB-SRV")
|
||||
.run();
|
||||
|
||||
tx.send((System::current(), srv, local_addr)).unwrap();
|
||||
crate::rt::spawn(async move {
|
||||
sleep(Millis(75)).await;
|
||||
tx.send((System::current(), srv, local_addr)).unwrap();
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue