mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Use a single long-lived RPC connection when authenticated
The prior system spawned a new connection per request to enable parallelism, yet kept hitting hyper::IncompleteMessages I couldn't track down. This attempts to resolve those by a long-lived socket. Halves the amount of requests per-authenticated RPC call, and accordingly is likely still better overall. I don't believe this is resolved yet but this is still worth pushing.
This commit is contained in:
@@ -26,7 +26,7 @@ pub enum Error {
|
||||
InvalidUri,
|
||||
MissingHost,
|
||||
InconsistentHost,
|
||||
SslError,
|
||||
SslError(Box<dyn Send + Sync + std::error::Error>),
|
||||
Hyper(hyper::Error),
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ impl Client {
|
||||
// If there's not a connection...
|
||||
if connection_lock.is_none() {
|
||||
let (requester, connection) = hyper::client::conn::http1::handshake(
|
||||
https_builder.clone().call(host.clone()).await.map_err(|_| Error::SslError)?,
|
||||
https_builder.clone().call(host.clone()).await.map_err(Error::SslError)?,
|
||||
)
|
||||
.await
|
||||
.map_err(Error::Hyper)?;
|
||||
|
||||
Reference in New Issue
Block a user