Compare commits

...
This repository has been archived on 2025-08-14. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.

4 commits

Author SHA1 Message Date
strawberry
eec0b41ea9 raise reqwest client timeout to 300 seconds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 15:06:07 -05:00
strawberry
b9e0d70f25 remove unnecessary else logic in sha256_media db migration
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 15:04:15 -05:00
strawberry
2176872bc5 raise report reason limit to 500 (though spec doesnt say to limit these)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 15:04:15 -05:00
strawberry
e3ff933124 raise various timeouts, make exp backoff consistent
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 15:04:15 -05:00
9 changed files with 16 additions and 17 deletions

View file

@ -44,7 +44,7 @@ where
let mut reqwest_request = reqwest::Request::try_from(http_request)?;
*reqwest_request.timeout_mut() = Some(Duration::from_secs(30));
*reqwest_request.timeout_mut() = Some(Duration::from_secs(120));
let url = reqwest_request.url().clone();
let mut response = match services()

View file

@ -370,7 +370,7 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
.get(server)
{
// Exponential backoff
let mut min_elapsed_duration = Duration::from_secs(30) * (*tries) * (*tries);
let mut min_elapsed_duration = Duration::from_secs(5 * 60) * (*tries) * (*tries);
if min_elapsed_duration > Duration::from_secs(60 * 60 * 24) {
min_elapsed_duration = Duration::from_secs(60 * 60 * 24);
}
@ -391,7 +391,7 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
(
server,
tokio::time::timeout(
Duration::from_secs(25),
Duration::from_secs(50),
services().sending.send_federation_request(
server,
federation::keys::get_keys::v1::Request {

View file

@ -1163,7 +1163,7 @@ fn validate_and_add_event_id(
.get(&event_id)
{
// Exponential backoff
let mut min_elapsed_duration = Duration::from_secs(30) * (*tries) * (*tries);
let mut min_elapsed_duration = Duration::from_secs(5 * 60) * (*tries) * (*tries);
if min_elapsed_duration > Duration::from_secs(60 * 60 * 24) {
min_elapsed_duration = Duration::from_secs(60 * 60 * 24);
}

View file

@ -31,10 +31,10 @@ pub async fn report_event_route(
));
};
if let Some(true) = body.reason.clone().map(|s| s.chars().count() > 250) {
if let Some(true) = body.reason.clone().map(|s| s.chars().count() > 500) {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Reason too long, should be 250 characters or fewer",
"Reason too long, should be 500 characters or fewer",
));
};

View file

@ -978,8 +978,6 @@ impl KeyValueDatabase {
services().globals.bump_database_version(14)?;
warn!("Migration: 13 -> 14 finished");
} else {
warn!("Skipping migration from version 13 to 14 for converting legacy base64 key file names to sha256 hashes of the base64 keys");
}
assert_eq!(

View file

@ -545,7 +545,7 @@ async fn shutdown_signal(handle: ServerHandle, tx: Sender<()>) -> Result<()> {
}
warn!("Received {}, shutting down...", sig);
handle.graceful_shutdown(Some(Duration::from_secs(30)));
handle.graceful_shutdown(Some(Duration::from_secs(60)));
services().globals.shutdown();

View file

@ -537,8 +537,8 @@ impl Service<'_> {
fn reqwest_client_builder(config: &Config) -> Result<reqwest::ClientBuilder> {
let mut reqwest_client_builder = reqwest::Client::builder()
.pool_max_idle_per_host(0)
.connect_timeout(Duration::from_secs(30))
.timeout(Duration::from_secs(60 * 3));
.connect_timeout(Duration::from_secs(60))
.timeout(Duration::from_secs(60 * 5));
if let Some(proxy) = config.proxy.to_proxy()? {
reqwest_client_builder = reqwest_client_builder.proxy(proxy);

View file

@ -1461,7 +1461,7 @@ impl Service {
.get(event_id)
{
// Exponential backoff
let mut min_elapsed_duration = Duration::from_secs(30) * (*tries) * (*tries);
let mut min_elapsed_duration = Duration::from_secs(5 * 60) * (*tries) * (*tries);
if min_elapsed_duration > Duration::from_secs(60 * 60 * 24) {
min_elapsed_duration = Duration::from_secs(60 * 60 * 24);
}
@ -1748,7 +1748,7 @@ impl Service {
.get(&signature_ids)
{
// Exponential backoff
let mut min_elapsed_duration = Duration::from_secs(30) * (*tries) * (*tries);
let mut min_elapsed_duration = Duration::from_secs(5 * 60) * (*tries) * (*tries);
if min_elapsed_duration > Duration::from_secs(60 * 60 * 24) {
min_elapsed_duration = Duration::from_secs(60 * 60 * 24);
}

View file

@ -219,7 +219,8 @@ impl Service {
}
TransactionStatus::Failed(tries, time) => {
// Fail if a request has failed recently (exponential backoff)
let mut min_elapsed_duration = Duration::from_secs(30) * (*tries) * (*tries);
let mut min_elapsed_duration =
Duration::from_secs(5 * 60) * (*tries) * (*tries);
if min_elapsed_duration > Duration::from_secs(60 * 60 * 24) {
min_elapsed_duration = Duration::from_secs(60 * 60 * 24);
}
@ -719,13 +720,13 @@ impl Service {
let permit = self.maximum_requests.acquire().await;
debug!("Got permit");
let response = tokio::time::timeout(
Duration::from_secs(2 * 60),
Duration::from_secs(5 * 60),
server_server::send_request(destination, request),
)
.await
.map_err(|_| {
warn!("Timeout waiting for server response of {destination}");
Error::BadServerResponse("Timeout waiting for server response")
warn!("Timeout after 300 seconds waiting for server response of {destination}");
Error::BadServerResponse("Timeout after 300 seconds waiting for server response")
})?;
drop(permit);